From 9d0654d604f60b66eec62de27a782b8b8e3f3b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sun, 20 Apr 2014 13:48:36 -0500 Subject: [PATCH] Backup count keep --- bash/cronbackup/backup.sh | 6 +++--- bash/cronbackup/config.sh | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bash/cronbackup/backup.sh b/bash/cronbackup/backup.sh index d6b3481..a841a5f 100644 --- a/bash/cronbackup/backup.sh +++ b/bash/cronbackup/backup.sh @@ -59,11 +59,11 @@ while read line; do echo " Check for existing backups "$FILENAME \(Have: $fCount\) - # keep up to 7 backup - if [ $fCount -ne 7 ]; then + # keep up to X backups + if [ $fCount -ne $KEEP ]; then # delete count - dCount=`expr $fCount - 7` + dCount=`expr $fCount - $KEEP` # loop over files for files in $BAKDIR/*$FILENAME*.gz; do diff --git a/bash/cronbackup/config.sh b/bash/cronbackup/config.sh index 319ecee..49be805 100644 --- a/bash/cronbackup/config.sh +++ b/bash/cronbackup/config.sh @@ -5,3 +5,5 @@ ERRLOG=backup_errors.log BMOUNT=/mnt/backup BAKDIR=$BMOUNT/backup/cron + +KEEP=7