serverscripts/wwwbackup.sh

20 lines
275 B
Bash
Raw Normal View History

#!/bin/bash
DATE=$(date +%Y%m%d%H%M)
BACKUPDIR='/BACKUP/www'
WWW='/var/www/'
rotate_backups() {
2015-06-15 15:56:36 +10:00
find $BACKUPDIR -type f -mtime +7 -exec rm -frv {} \;
}
2015-06-15 15:56:36 +10:00
rotate_backups
cd $WWW
for folder in `ls -d *`; do
tar -zcvf $BACKUPDIR/$folder-$DATE.tar.gz $folder
done