]> git.sesse.net Git - backup.sh/blobdiff - backup.sh
Delete lockfile on abort; we should try again automatically next night.
[backup.sh] / backup.sh
index c09d0df29059da19ca198024d1ecd9d78f2e0cf1..5c240aa87ed6c74f1c48f27d0b9491b78901cd2e 100755 (executable)
--- 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