• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • Debian 11 has reached its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.81 is the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

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