Improved the backup script

This commit is contained in:
Laurent Raufaste 2013-05-04 21:55:15 -04:00
parent a1eaf620b0
commit 10193b82cc

View File

@ -6,11 +6,13 @@ DATE=`date +"%Y-%m-%d"`
SQL_DUMP_FILE=$BACKUP_FOLDER/pouet-$DATE.sql
# Backup the database
rm -f $SQL_DUMP_FILE.gz
mysqldump pouet > $SQL_DUMP_FILE
gzip $SQL_DUMP_FILE
# Backup the user submitted files
tar zcf $BACKUP_FOLDER/pouet-content-$DATE.tgz $CONTENT_FOLDER
rm -f $BACKUP_FOLDER/pouet-content-$DATE.tgz
tar -z -c -f $BACKUP_FOLDER/pouet-content-$DATE.tgz -C $CONTENT_FOLDER .
# Cleanup old files
find $BACKUP_FOLDER -mtime 15 -delete
find $BACKUP_FOLDER -mtime +15 -delete