• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    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. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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