Created
April 22, 2013 20:27
-
-
Save peb7268/5438243 to your computer and use it in GitHub Desktop.
bash: mysql auto dump
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
NOW=$(date '+%m_%d_%Y_%s') | |
DBS=`cat /bu/dbs.out` | |
#DBS="$(mysql -u root -h localhost -ppassword -Bse 'show databases')" | |
for db in $DBS | |
do | |
FILE=${db}_${NOW}.gz | |
OLDFILE=${db}_*.gz | |
#rm -f /bu/$OLDFILE | |
mysqldump -u root -h localhost -pronky $db | /bin/gzip -9 > /bu/$FILE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment