Manually backup databases managed by plesk for linux

 Wrote a quick little script to get all the mysql database names managed by Plesk for linux and then manually back them up.

#!/bin/bash

MYSQLPASS=`cat /etc/psa/.psa.shadow`
# Day of week
DAY=`date +%u`
DIR=”/mnt/backup/mysql”

# Backup mysql database
mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` -c -e –add-drop-table –add-locks –allow-keywords mysql > $DIR/mysql.$DAY.sql

for DB in `mysql -Ns -uadmin -p$MYSQLPASS -Dpsa -e “select name from data_bases”`;
do mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` -c -e –add-drop-table –add-locks –allow-keywords $DB > $DIR/$DB.$DAY.sql;
done