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.


MYSQLPASS=`cat /etc/psa/.psa.shadow`
# Day of week
DAY=`date +%u`

# 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;