Remove old backups prior to making a new one

This commit is contained in:
Bob Mottram 2015-11-04 17:25:39 +00:00
parent c26b60bd39
commit d73e1616af
1 changed files with 5 additions and 0 deletions

View File

@ -222,6 +222,9 @@ WATCHDOG_SCRIPT_NAME="keepon"
# the type of backup system used, rsync or obnam
BACKUP_TYPE='obnam'
# Number of days to keep backups for
BACKUP_MAX_DAYS=30
# Name of a script used to create a backup of the system on usb drive
BACKUP_SCRIPT_NAME="backup"
@ -2466,6 +2469,7 @@ function backup_directory_to_usb {
echo -n "}' | awk -F '/' '{print " >> /usr/bin/$BACKUP_SCRIPT_NAME
echo -n '$2' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "}')" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " obnam forget --keep=${BACKUP_MAX_DAYS}d" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}' >> /usr/bin/$BACKUP_SCRIPT_NAME
else
# For rsyncrypto usage see http://archive09.linux.com/feature/125322
@ -3972,6 +3976,7 @@ function backup_directory_to_friend {
echo -n '$2' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo "}')" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo " obnam forget --keep=${BACKUP_MAX_DAYS}d" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo -n ' obnam backup -r $SERVER_DIRECTORY/backup/ ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo '--encrypt-with $MY_BACKUP_KEY_ID ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo '${2} ${1}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME