• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Reboot server outside of Plesk control panel?

W

webcanada

Guest
Hey guys,

I'm trying to write a PHP script which I can put in a protected directory, that I can get to using any browser, to reboot the server. I've found that once in a while, things get messed up, or stop running, etc., and a reboot fixes it all.

I would love to be able to initiate a reboot from my phone/PDA (which can't sign into Plesk .. I'm assuming IE Mobile doesn't support JS or something else).

So I've made a script that calls:

$reboot = shell_exec("shutdown -r");

... but this doesn't seem to do anything. The domain on which this script resides has safe mode turned off, but I'm assuming there's some higher level protection that prevents a web user from rebooting the server.

Has anyone done anything similar? Perhaps there's some Plesk API way of doing this?

Thanks!
 
Don't you need s.th. like this?

$reboot = shell_exec("shutdown -r now");

or depending on your distribution perhaps
a
$reboot = shell_exec("reboot");

Good Luck :)
 
Probably it is been disabled in PHP.ini, search for disable_functions

I've got:
disable_functions = curl_exec, exec, ini_alter, parse_ini_file, passthru, shell_exec, pfsockopen, proc_close, proc_get_status, posix_six_setuid, posix_setsid, posix_setpgid, posix_kill, system, proc_nice, proc_open, proc_terminate

So your script will most definitly NOT work on my server...

edit:
Notice that PHP will run your script as apache, and i dont think that apache is allowed to reboot a server either.

Try to learn more working with ssh and restarting the services. Like /etc/init.d/httpd start|stop|restart etc.
If a services fails to start, is maybe because of an existing PID, kill the pid and try again. Or for httpd try /etc/init.d/httpd configtest, before restarting the service

SSH works perfect on a mobile/PDA, and is saver than a browser... (in my humble opinion ;) )
 
Back
Top