]> git.sven.stormbind.net Git - sven/scripts.git/commitdiff
On some systems /var/lock/ is on tmpfs or will be cleaned otherwise
authorSven Hoexter <sven@timegate.de>
Wed, 27 Apr 2011 14:20:08 +0000 (16:20 +0200)
committerSven Hoexter <sven@timegate.de>
Wed, 27 Apr 2011 14:20:08 +0000 (16:20 +0200)
on reboot. So we've to make sure that our subdir in /var/lock is
created with approriate permissions before we touch the lockfile.

hetzner/hetznerbackupv2.sh

index 7f07a0461eb17f6cc51bfecbd5979eae80b6d05d..cd0e8306f412a2280269799227822c074a529ce4 100755 (executable)
@@ -16,7 +16,8 @@ FTP_USER=uxxx
 FTP_HOST=uxxx.your-backup.de
 PROTO=ssh
 ROOTMAIL="root@localhost"
-LOCKFILE="/var/lock/backup/hetznerbackup"
+LOCKDIR="/var/lock/backup"
+LOCKFILE="$LOCKDIR/hetznerbackup"
 LOGFILE="/var/log/hetznerbackup"
 SESSIONLOG=$(mktemp /var/tmp/hetznerbackup.XXXXXXXXX)
 ERRSTAT=0
@@ -59,6 +60,9 @@ if [ -e $LOCKFILE ]; then
     echo "This is a typical result of a failed backup run, please contact your admin"
     exit 5
 else
+    if [ ! -d $LOCKDIR ]; then
+       mkdir -m 700 $LOCKDIR
+    fi
     touch $LOCKFILE
 fi