]> git.decadent.org.uk Git - dak.git/commitdiff
config/debian/cron.hourly: remove unchecked lock on failure
authorAnsgar Burchardt <ansgar@debian.org>
Sat, 15 Dec 2012 08:31:00 +0000 (09:31 +0100)
committerAnsgar Burchardt <ansgar@debian.org>
Sat, 15 Dec 2012 08:31:00 +0000 (09:31 +0100)
config/debian/cron.hourly

index cbc687fb219b4e1e1c730d49e640baff46ef0843..51f9d8120a41983597019bdc21d2789f84ed8008 100755 (executable)
@@ -20,10 +20,16 @@ dak import-users-from-passwd
 
 # do not run show-new and other stuff in parallel
 LOCKFILE="$lockdir/unchecked.lock"
+cleanup() {
+    rm -f "${LOCKFILE}"
+}
+
 if lockfile -r16 $LOCKFILE 2> /dev/null; then
+    trap cleanup EXIT
     do_new
     dak show-new > /dev/null || true
-    rm -f $LOCKFILE
+    cleanup
+    trap - EXIT
 fi
 
 dak queue-report -n > $webdir/new.html