Linux Plesk Shutdown

Imagine you want to make a backup of everything on your web site, before redeploying your server or moving your site to a different machine, you need to be absolutely confident you have backed everything up, and that your database has not been updated, or mail has not arrived since you started the backup, then you need to shutdown all the services before making the backup. If you are using Plesk, software designed to make server management easier, you can do the shutdown before backing up from the command line. Create yourself a shell script with the following contents:

/usr/local/psa/admin/bin/modules/watchdog/wdservice monit stop /usr/local/psa/etc/modules/watchdog/monitrc   
/usr/local/psa/admin/bin/modules/watchdog/wdservice wdcollect stop /usr/local/psa/etc/modules/watchdog/wdcollect.inc.php    
/etc/init.d/crond stop     
/usr/local/psa/admin/bin/httpsdctl stop    
/usr/local/psa/admin/bin/websrvmng --stop     
/usr/local/psa/admin/bin/mailmng --stop-qmail-send     
/usr/local/psa/admin/bin/mailmng --stop-maild     
/etc/init.d/xinetd stop     
/etc/init.d/mailman stop     
/usr/local/psa/admin/bin/dnsmng --stop    
/usr/local/psa/admin/bin/tomcatmng --stop     
/usr/local/psa/admin/bin/cfmng --stop   
/etc/init.d/mysqld stop     
/usr/local/psa/admin/bin/pg_manage --stop   
/usr/local/psa/admin/bin/spamd --stop     
/usr/local/psa/admin/bin/drwebmng --stop   
/etc/init.d/saslauthd stop

Note: The first two lines are actually wrapped (the two commands beginning /usr/local/psa/admin/bin/modules/watchdog/wdservice). These lines are in fact very important to get right as they relate to the watchdog module. The watchdog module is normally very useful, restarting services when they fail for one reason or another, however in the case where you would like to shutdown all your services, the watchdog services need to be shutdown first otherwise they may just restart the other services you wish to shutdown.

The above bash script was tested with Plesk 8.3 and Red Hat Fedora Core 4. You must be logged in as root to be able to execute this script.

If you have any doubts or questions, leave a comment and I’ll see if I can help.