Hsphere mysql backup script
Monday, June 4th, 2007Need to backup your mysql databases in a pinch? Here is a quick script for making backups of the mysql databases on a hsphere db server:
#!/bin/bash
#
#
TODAY=`date +%m-%d-%Y`
for i in $( ls -l /var/lib/mysql/ | grep drwx | awk '{print $9}' ); do
/hsphere/shared/bin/sudo -H -u mysql mysqldump -Q --opt -u root $i > $i.$TODAY.sql
done
It will put the database dumps in the directory where you run this script.