From a27374ac4b9f199a34537e4715d233b02e90ae46 Mon Sep 17 00:00:00 2001 From: jolan78 Date: Mon, 10 Apr 2017 17:17:51 +0200 Subject: [PATCH] dspam_ : remove lock if previous execution failed --- plugins/dspam/dspam_ | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/dspam/dspam_ b/plugins/dspam/dspam_ index a4b4e882..c16ddfe5 100755 --- a/plugins/dspam/dspam_ +++ b/plugins/dspam/dspam_ @@ -211,7 +211,16 @@ file_is_locked() { local file=$1 local lock=$1.lock - [ -f $lock ] && debug file $file is locked && return 0 # EX_OK + if [ -f "$lock" ];then + debug file $file is locked + local pid=$(cat "$lock") + if ps h -p "$pid" -o comm=|grep -q dspam_; then + return 0 # EX_OK + else + debug lock for file $file is no longer valid + file_remove_lock $file + fi + fi debug file $file is not locked return 69 # EX_UNAVAILABLE }