[scripts] kill stale pids automatically

This commit is contained in:
Fabio Erculiani 2012-09-05 09:11:07 +02:00
parent 48f3216b04
commit 4ddf624999

View File

@ -1,11 +1,14 @@
#!/bin/sh
ISO_BUILD_LOCK=/tmp/.daily_iso_build.sh.lock
LOCK_TIMEOUT=$((3600 * 2)) # 2 hours
LOCK_TIMEOUT=$((3600 * 12)) # 12 hours
kill_stale_process() {
echo "[kill] NOT killing stale process automatically for NOW" >&2
#local inode=$(stat -L --format '%i' "${ISO_BUILD_LOCK}") # ignore device...
#local pids=$(cat /proc/locks | grep ":${inode}" | awk '{ print $5 }')
return 1
echo "[kill] NOT killing stale processes automatically: " >&2
local pids=$(lsof "${ISO_BUILD_LOCK}" | tail -n +2 | awk '{ print $2 }')
echo ${pids} >&2
#for pid in ${pids}; do
# kill -TERM ${pid}
#done
return 0
}