Revision: 31375
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 3, 2010 19:41 by eusonlito
Initial Code
#! /bin/sh # ------------------------------------- # Script to do a full databases backup # and store it X days # # A Navalla Suiza 08/03/2010 # # This script is freely distributed under the GPL # ------------------------------------- # Configuration variables # ------------------------------------- USER='MySQL-USER' PASS='MySQL-PASSWORD' HOST='localhost' BACKUPDIR='/var/backups/mysql' # Script execution # ------------------------------------- data=`date +%Y%m%d` for i in `mysql -u $USER -h $HOST -p$PASS -Bse 'show databases'`; do echo 'Processing '$i mysqldump --add-drop-table -u$USER -p$PASS $i | gzip -9 > $BACKUPDIR/$data-$i.sql.gz done find $BACKUPDIR -type f -mtime +7 -exec rm -f {} \;
Initial URL
Initial Description
Script to backup all MySQL databases and delete copies after X days
Initial Title
Backup all MySQL databases
Initial Tags
mysql, backup
Initial Language
Bash