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