X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=backup.sh;h=5c240aa87ed6c74f1c48f27d0b9491b78901cd2e;hb=8c5d3a5b131691465f0c7fb9960e183019a5c4ce;hp=c09d0df29059da19ca198024d1ecd9d78f2e0cf1;hpb=710a5b158ee95c4b26bf19339fb1a3a73092a25e;p=backup.sh diff --git a/backup.sh b/backup.sh index c09d0df..5c240aa 100755 --- a/backup.sh +++ b/backup.sh @@ -28,9 +28,9 @@ computer=$1 LOCKFILE=/home/backup/backuprun.lockfile.$computer confdir=/home/backup/conf/ # Configuration files storagedir=/backup # Where we keep backups -maksantallfulle=3 # Number of full backups -dagermellomfulle=30 # Days between full backups -dagermellomfulleforfast=32 # Days between full backups for machines with fixed +maxnumfull=3 # Number of full backups +daysbetweenfull=30 # Days between full backups +daysbetweenfullforfixed=32 # Days between full backups for machines with fixed # full-backup date (in case the fixed day gets missed) DAY_OF_MONTH=`date "+%d" | sed s/^0//` # from 1 to 31 DATE=`date "+%Y%m%d%H%M"` #format: touch @@ -47,7 +47,8 @@ fi # Die more or less gracefully (at least notify user) die() { - echo `date`": Something nasty happened. Ending, and not deleting lockfile $LOCKFILE." + echo `date`": Something nasty happened." + rm $LOCKFILE exit 1 } @@ -235,17 +236,17 @@ do # Check if we want a full backup if [ -f $confdir/fastfullbackupdag.$computer.$sfilesystem ]; then - fullbackup_min_for_this_machine=$dagermellomfulleforfast + fullbackup_min_for_this_machine=$daysbetweenfullforfixed if [ "$DAY_OF_MONTH" = "`cat $confdir/fastfullbackupdag.$computer.$sfilesystem`" ]; then backuplevel=full fi elif [ -f $confdir/fastfullbackupdag.$computer ]; then - fullbackup_min_for_this_machine=$dagermellomfulleforfast + fullbackup_min_for_this_machine=$daysbetweenfullforfixed if [ "$DAY_OF_MONTH" = "`cat $confdir/fastfullbackupdag.$computer`" ]; then backuplevel=full fi else - fullbackup_min_for_this_machine=$dagermellomfulle + fullbackup_min_for_this_machine=$daysbetweenfull fi if [ -z "`find $storagedir/$computer/$sfilesystem/full/ -name \*tgz -mtime -$fullbackup_min_for_this_machine`" ]; then @@ -262,7 +263,7 @@ do if [ -f $confdir/maksfulle.$computer ] ; then mf=$((`cat $confdir/maksfulle.$computer`+1)) else - mf=$(($maksantallfulle+1)) + mf=$(($maxnumfull+1)) fi # Delete old full backups