2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

dspam_ : remove lock if previous execution failed

This commit is contained in:
jolan78 2017-04-10 17:17:51 +02:00
parent fdbfa2c903
commit a27374ac4b

View File

@ -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
}