Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- BACKUPDIR=/var/backups/files
- ROTATE=1
- mkdir -p $BACKUPDIR
- CURRENT="$BACKUPDIR/`date +%Y-%m-%d`-files.tar.gz"
- cd /var/ && tar czf $CURRENT www
- find $BACKUPDIR -type f -mtime $ROTATE -exec rm {} ;
- chmod 0600 $BACKUPDIR/*
- find $BACKUPDIR -type f -mtime $ROTATE -exec rm {} ;
- #!/bin/sh -e
- BACKUPDIR=/var/backups/files
- # I suggest a little more than 1 day (i.e. about 1 week of backups is
- # probably safer.)
- ROTATE=7
- mkdir -p $BACKUPDIR
- CURRENT="$BACKUPDIR/`date +%Y-%m-%d`-files.tar.gz"
- # Create protected file, then backup data in it
- touch $CURRENT
- chmod 600 $CURRENT
- cd /var/ && tar czf $CURRENT www
- # Here we have the attempt at deleting, notice the "+"
- find $BACKUPDIR -type f -name '*-files.tar.gz' -mtime +$ROTATE -delete
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement