Last active
December 21, 2015 15:19
-
-
Save sajanp/6325716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=$(date +"%m-%d-%Y") | |
DATABASES=`mysql -e "SHOW DATABASES" | tr -d "| " | grep -Ev 'Database|information_schema|performance_schema|mysql'` | |
echo "Dumping Databases" | |
for db in $DATABASES | |
do | |
echo "========================" | |
echo "Dumping $db" | |
mysqldump --add-drop-table $db > /var/backups/$DATE-$db.sql | |
echo "========================" | |
done | |
echo "Done Dumping Databases" | |
echo "=======================" | |
echo "Transferring Databases" | |
rsync -rltgoD --progress /var/backups/ [email protected]:/storage/noppix/lemp2/mysql/ | |
echo "======================" | |
echo "Removing Databases" | |
rm -rf /var/backups/*.sql | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment