Linux Plesk Full Backup

Plesk already provides a script who’s intention is to perform a full backup in a more or less machine/version/software independent manor, however, I have noticed that it doesn’t necessarily backup every single property of every single application. For example, it doesn’t backup and restore a lot of settings for the mailing list manager software it uses - Mailman -

An example of a full backup on Plesk, belt and braces:

dates=`date +%Y%m%d%H%M%S`   
/usr/local/psa/bin/pleskbackup all /home/{myhome}/plesk-${dates}   
source /root/shutdown-psa.sh   
/etc/init.d/mysqld start mysqldump --all-databases --user=admin --password={mysqlrootpw} | bzip2 > /home/{myhome}/plesk-db-${dates}.sql.bz2   
tar cvjf /home/{myhome}/plesk-bku-${dates}.tar.bz2 /var/www/vhosts /etc /var/lib/mailman /root/*.sh /var/qmail /home/{myhome}/plesk-db-${dates}.sql.bz2   
chown {user}:{group} /home/{myhome}/plesk-db-${dates}.sql.bz2 chown {user}:{group} /home/{myhome}/plesk-bku-${dates}.tar.bz2   
chown {user}:{group} /home/{myhome}/plesk-${dates}.gz 

This is an example (and would need to be run as root ). The script referred to above ‘shutdown-psa.shcan be found here. Obviously it should be placed in the root directory when you have copied it to your server.

To use this scripts, please substitute:

  • {mysqlrootpw} : The SQL root password
  • {myhome}: Your home directory (its usually the same as your username)
  • {user}: Your username
  • {group}: Your Group

This runs the standard plesk backup (and also the plesk shutdown script mentioned in my previous post). It also creates a dump of the mysql database, and a file system backup of the critial data areas on your server. However before using this script, please review it carefully and make any alterations that might be suitable to your situation. If you have any doubts or questions, leave a comment and I’ll see if I can help. Please of course remember to test your backups once you have made them, to be sure that this script works in your situation.