Created
December 6, 2008 13:02
-
-
Save choonkeat/32869 to your computer and use it in GitHub Desktop.
backup cron (backups of last 7 days, last month or any year)
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 | |
# | |
# place this file in the directory you want to keep the backup | |
# mysqldumps. this script lets you retrieve dumps of last 7 days, | |
# last month or any year | |
# | |
BACKUP_DB=app_production | |
cd `dirname $0` | |
mysqldump $BACKUP_DB -u root > today.sql && \ | |
gzip -f today.sql && \ | |
cp today.sql.gz "`date +'%G'`".sql.gz && \ | |
cp today.sql.gz "`date +'%b'`".sql.gz && \ | |
cp today.sql.gz "`date +'%a'`".sql.gz | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment