From: Sven Hoexter Date: Wed, 27 Apr 2011 14:20:08 +0000 (+0200) Subject: On some systems /var/lock/ is on tmpfs or will be cleaned otherwise X-Git-Url: https://git.sven.stormbind.net/?a=commitdiff_plain;h=fce842f605cc19b181e4952b38f892f311d1d4fd;p=sven%2Fscripts.git On some systems /var/lock/ is on tmpfs or will be cleaned otherwise on reboot. So we've to make sure that our subdir in /var/lock is created with approriate permissions before we touch the lockfile. --- diff --git a/hetzner/hetznerbackupv2.sh b/hetzner/hetznerbackupv2.sh index 7f07a04..cd0e830 100755 --- a/hetzner/hetznerbackupv2.sh +++ b/hetzner/hetznerbackupv2.sh @@ -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