Plesk Website Mail and Database Backup Script


Is your server loaded heavily while Plesk backup is running? You can use following script will help you backing up mail, and website contents of your plesk server, you need to execute this is your plesk server. All you need to have is password less authentication from your plesk server to backup server. Replace xx.xx.xx.xx with your backup sever IP. For database backup you may use the link.


#!Script to Backup Mail and website contents of Plesk accounts
cd /var/www/vhosts

for x in `ls -d * |tr -d /`


ssh xx.xx.xx.xx mkdir -p /web/backup/path/$x
rsync -arzv -e /var/www/vhosts/$x/httpdocs/* root@xx.xx.xx.xx:/web/backup/path/$x/httpdocs/.

ssh xx.xx.xx.xx mkdir -p /mail/backup/path/$x
rsync -arv -e  /var/qmail/mailnames/$x/* root@xx.xx.xx.xx:/mail/backup/path/$x/.


cd /var/lib/mysql
for DBs in $(ls -d */ |tr -d /)

cd /mysqlbackup

`mysqldump -u admin -p'password' $DBs > $DBs.sql`


`ssh root@xx.xx.xx.xx mkdir -p /mysql/backup/path/`
rsync -avr /mysqlbackup/* ssh root@xx.xx.xx.xx:/mysql/backup/path/.


Thank you for viewing

Leave a Reply

Protected by WP Anti Spam