Reboot

Aus Programmers Guide

Wechseln zu: Navigation, Suche

Inhaltsverzeichnis

Server mit PHP neu starten

Der PHP-Teil

function shellExec($command){
	$output = shell_exec($command);
return $output;
}
 
 
function rebootServer(){
	shellExec("touch /var/lock/reboot.lock");
return "Das System wird in der nächsten Minute neu gestartet...";
}

Der Shell-Teil

sudo vim /etc/ownsystem/reboot
#insert
#-------------------------start------------------------
#!/bin/bash
if [ -f /var/lock/reboot.lock ]
then
  rm /var/lock/reboot.lock
 
  if [ ! -f /var/lock/reboot.lock ]
  then
    reboot now
  fi
fi
exit 0
#--------------------------stop------------------------
#:wq for save and quit

Der Crontab-Teil

crontab -e
#insert
*/1 *  * * *   root    /etc/ownsystem/reboot > /dev/null 2>&1
Persönliche Werkzeuge