pouet.net/bin/backup
2013-05-04 21:55:15 -04:00

19 lines
491 B
Bash
Executable File

#!/bin/sh
BACKUP_FOLDER=/home/hosted/pouet/backup
CONTENT_FOLDER=/home/hosted/pouet/sites/content.pouet.net
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
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