How to take domain database backup in plesk

# cat domain_dump.sh
var_remote=’remote_ip_address’
mkdir /root/dump_temp/
mysql -u admin -p`cat /etc/psa/.psa.shadow ` -e “show databases” |grep -v “-” |grep -Ev ‘Database|information_schema’ >> /root/backuplist
for i in `cat /root/backuplist`;
do
echo “database is $i”
mysqldump -u admin -p`cat /etc/psa/.psa.shadow` $i > /root/dump_temp/$i.sql
echo “dump of $i created”
done
echo “Creating the tar file in /root”
cd /root
tar -cvzf /root/dump_`date +”%Y-%m-%d”`.tar.gz dump_temp/
lftp $var_remote<<EOF | sort>$TMPFILE
user “username” “password”
cd IP/directory
put dump_`date +”%Y-%m-%d”`.tar.gz
EOF
echo “Deleteing the backup files”
rm -rf /root/dump_temp
rm -rf /root/dump_`date +”%Y-%m-%d”`.tar.gz

Advertisements
1 comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: