Created
October 25, 2011 01:38
-
-
Save chorrell/1311060 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
DBPATH=/home/hybrid/mysql_backups | |
MYSQLDMP=/opt/local/bin/mysqldump | |
FIND=/opt/local/bin/find | |
DATE=`date "+%Y-%m-%d"` | |
$MYSQLDMP --opt --skip-add-locks --user=hybrid_dbuser --password= xxxxxx --default-character-set=utf8 hybrid_forumdb | gzip > ${DBPATH}/hybrid_forumdb-${DATE}.gz | |
chown hybrid:hybrid ${DBPATH}/hybrid_forumdb-${DATE}.gz | |
# Deletes old backups | |
for DIR in `ls -1 $DBPATH` | |
do | |
$FIND ${DBPATH}/${DIR}/*.gz -mtime +14 -delete | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment