diff options
-rw-r--r-- | backup.conf | 11 | ||||
-rwxr-xr-x | backup.in | 12 | ||||
-rwxr-xr-x | lastBackups.in | 7 |
3 files changed, 28 insertions, 2 deletions
diff --git a/backup.conf b/backup.conf index 82fa2c0..9cc3753 100644 --- a/backup.conf +++ b/backup.conf @@ -17,8 +17,17 @@ backups["proxiedBackup"]="/path/to/destination/ user@source:path proxy_user@ssh_ # how long to wait for destination directories to appear in lastBackups [seconds] maxWait=100 -# how old may backups be before we warn about outdated ones [seconds] +# how old may (seldom) backups be before we warn about outdated ones [seconds] outdatedLimit=$[2*24*60*60] +outdatedSeldomLimit=$[3*7*24*60*60] + +# list of backups which should be made less often +seldomBackups=( + "slowBackup" +) + +# number of days that should pass between seldom backups +seldomness=14 # subdirectories which should be appended to the parent directory in the report recognSubdirRegex="home\|boot\|root\|erich" @@ -38,11 +38,16 @@ then fi fi +seldom=false if [ $# -eq 0 ] then backupID="$(basename $0)" [ -z "${backups[${backupID}]}" ] && usage set /tmp/${backupID}.pid ${backups[${backupID}]} + if printf '%s\n' "${seldomBackups[@]}" | \ + grep -qxF "${backupID}"; then + seldom=true + fi fi Basis="$2" @@ -95,6 +100,13 @@ fi [ -w "${Basis}" ] || exit 11 [ -e "${neues_Datum}" ] && exit 4 +if ${seldom}; then + for date_diff in $(seq ${seldomness}); do + if [ -e "${Basis}/$(date '+%Y_%m_%d' -d@$(($(date '+%s')-24*60*60*date_diff)))" ]; then + exit 4 + fi + done +fi [ -e "${pidFile}" ] && exit 5 echo $$ > "${pidFile}" diff --git a/lastBackups.in b/lastBackups.in index ef742cd..9f0d3e8 100755 --- a/lastBackups.in +++ b/lastBackups.in @@ -61,7 +61,12 @@ do if [ ! -d "${dest}/${lbu}" ] then veraltet[${#veraltet[@]}]="LEER!" - elif [ ${delta} -gt ${outdatedLimit} ] + elif [ ${delta} -gt ${outdatedLimit} ] && \ + ! printf '%s\n' "${seldomBackups[@]}" | \ + grep -qxF "${backupID}" + then + veraltet[${#veraltet[@]}]="VERALTET!" + elif [ ${delta} -gt ${outdatedSeldomLimit} ] then veraltet[${#veraltet[@]}]="VERALTET!" else |