From d70e8ff536c6307d9d5fea5a1044670f3b334ae9 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 18 Oct 2022 13:33:34 +1000 Subject: Actually exit when still running. --- update_apt-panopticon | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/update_apt-panopticon b/update_apt-panopticon index ebd5e45..219d86a 100755 --- a/update_apt-panopticon +++ b/update_apt-panopticon @@ -14,7 +14,12 @@ fi # Check if the lock file still exists. if [ -f apt-panopticon.lock ] ; then # Check if it's still running. - ps ax -eo pid,args | grep "luajit ./apt-panopticon.lua" | grep -v "grep luajit ./apt-panopticon.lua" | while read line ; do echo "Previous apt-panopticon still running, exiting." exit 1 ; done + ps ax -eo pid,args | grep "luajit ./apt-panopticon.lua" | grep -v "grep luajit ./apt-panopticon.lua" | while read line ; do touch apt-panopticon.running ; exit ; done + if [ -f apt-panopticon.running ] ; then + echo "Previous apt-panopticon still running, exiting." + rm apt-panopticon.running + exit 1 + fi echo "Crashed apt-panopticon detected, removing stale lock file." rm apt-panopticon.lock fi -- cgit v1.1