$diff-ruN./rbme-orig./rbme---./rbme-orig2010-07-1419:00:51.000000000+1000+++./rbme2012-06-0111:07:49.000000000+1000@@-62,6+62,7@@##GSSSchlomoSchapiro<rbme@schlomo.schapiro.org>#FBUFridtjofBusse<fbusse@probusiness.de>+#AAAryaA.##Versions:CHANGES='@@ -85,6 +86,7 @@ 2009-01-30 GSS changed %S to %s for SLES9 compatibility (thanks to werner.flamme@ufz.de) 2009-08-31 GSS changed mail sending to sendmail in error routine 2009-09-01 GSS fixed stupid bug where SENDMAIL was defined after the first use of die()+2012-06-01 AA Added support for MAX_KEEP_OLD_BACKUPS, defaults to unlimited for backward compatibility 'COPYRIGHT="Copyright (C) 2006,2009 Schlomo Schapiro"@@-189,7+191,10@@die"ERROR: You must keep at least 1 old backup ('MIN_KEEP_OLD_BACKUPS' is '$MIN_KEEP_OLD_BACKUPS')"}-exportBACKUP_PATHMIN_FREE_BEFORE_HOST_BACKUPMIN_INODES_BEFORE_HOST_BACKUPMIN_FREE_AFTER_HOST_BACKUPMIN_INODES_AFTER_HOST_BACKUPMIN_KEEP_OLD_BACKUPSRSYNCRSYNC_RSHRSYNC_EXTRA_OPTIONSVERBOSEREPORTSTATISTICSDEBUGMAILTOMAILFROMMAILSTYLELOGFILE+#Howmanyoldbackupstokeepatmost(defaultstounlimited)+MAX_KEEP_OLD_BACKUPS="${MAX_KEEP_OLD_BACKUPS:=0}"++exportBACKUP_PATHMIN_FREE_BEFORE_HOST_BACKUPMIN_INODES_BEFORE_HOST_BACKUPMIN_FREE_AFTER_HOST_BACKUPMIN_INODES_AFTER_HOST_BACKUPMIN_KEEP_OLD_BACKUPSMAX_KEEP_OLD_BACKUPSRSYNCRSYNC_RSHRSYNC_EXTRA_OPTIONSVERBOSEREPORTSTATISTICSDEBUGMAILTOMAILFROMMAILSTYLELOGFILE#howdowecallthesituation,whentheFSdoesnotneedfreeinodes(reiserfs...)?PLENTY=plenty@@-229,7+234,7@@Currentconfiguration:(changesettingsin/etc/rbme.conf(Master)and/etc/$ME.conf(Instance))EOF-forvarinBACKUP_PATHMIN_FREE_BEFORE_HOST_BACKUPMIN_INODES_BEFORE_HOST_BACKUPMIN_FREE_AFTER_HOST_BACKUPMIN_INODES_AFTER_HOST_BACKUPMIN_KEEP_OLD_BACKUPSRSYNCRSYNC_RSHRSYNC_EXTRA_OPTIONSVERBOSEREPORTSTATISTICSDEBUGMAILTOMAILFROMMAILSTYLELOGFILE;do+forvarinBACKUP_PATHMIN_FREE_BEFORE_HOST_BACKUPMIN_INODES_BEFORE_HOST_BACKUPMIN_FREE_AFTER_HOST_BACKUPMIN_INODES_AFTER_HOST_BACKUPMIN_KEEP_OLD_BACKUPSMAX_KEEP_OLD_BACKUPSRSYNCRSYNC_RSHRSYNC_EXTRA_OPTIONSVERBOSEREPORTSTATISTICSDEBUGMAILTOMAILFROMMAILSTYLELOGFILE;doprintf"\t%30s = %s\n"$var"${!var}"done@@-315,8+320,12@@lastbackup="$BACKUP_PATH/$client/$today"backups=""fi--iftest$space-lt$min_space-o$inodes-lt$min_inodes;then++#AddedsupportforMAX_KEEP_OLD_BACKUPS+iftest$space-lt$min_space-o$inodes-lt$min_inodes\+||\+test$MAX_KEEP_OLD_BACKUPS-gt0-a${#backups[@]}-gt$MAX_KEEP_OLD_BACKUPS+thenecho-e"\tRemoving old backups to free some disk space"1>&2numbackups=${#backups[*]}echo-e"\tOldest backup (from $numbackups): $(basename "$backups")"1>&2@@-328,7+337,9@@#accidentiallywiththenextbackuptodelete:-)whiletest$((numbackups-deleted))-gt$MIN_KEEP_OLD_BACKUPS\&&\-test$space-lt$min_space-o$inodes-lt$min_inodes+test$space-lt$min_space-o$inodes-lt$min_inodes\+||\+test$MAX_KEEP_OLD_BACKUPS-gt0-a$((numbackups-deleted))-gt$MAX_KEEP_OLD_BACKUPSdoecho-en"\tHaving $space MB"1>&2test$min_inodes-gt0&&echo-n" & $inodes inodes"1>&2
rbme.conf
$ diff -ruN ./rbme.conf-orig ./rbme.conf
--- ./rbme.conf-orig 2010-07-14 19:00:51.000000000 +1000
+++ ./rbme.conf 2012-06-01 10:58:39.000000000 +1000
@@ -30,6 +30,10 @@
# This must be >1 !!MIN_KEEP_OLD_BACKUPS=5
+# Keep at most this many backups, regardless of how much free
+# space is present. Set to 0(or unset)for unlimited.
+MAX_KEEP_OLD_BACKUPS=0
+
# verbose mode, unset to suppress outputVERBOSE=${VERBOSE=}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-06-01
Sorry, my bad. The gt's should be ge's.
Change:
test $MAX_KEEP_OLD_BACKUPS -gt 0 -a ${#backups[@]} -gt $MAX_KEEP_OLD_BACKUPS
to this:
test $MAX_KEEP_OLD_BACKUPS -gt 0 -a ${#backups[@]} -ge $MAX_KEEP_OLD_BACKUPS
and this:
test $MAX_KEEP_OLD_BACKUPS -gt 0 -a $((numbackups-deleted)) -gt $MAX_KEEP_OLD_BACKUPS
to this:
test $MAX_KEEP_OLD_BACKUPS -gt 0 -a $((numbackups-deleted)) -ge $MAX_KEEP_OLD_BACKUPS
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Diff is below.
rbme
rbme.conf
Sorry, my bad. The gt's should be ge's.
Change:
to this:
and this:
to this:
Cheers