From 37e4c66a1c4e3560685b29d52218db6090cfe1dc Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 20 Aug 2016 12:44:40 +0200 Subject: PID files auslesen --- shutdownasap.conf.in | 24 ++++++++++++++---------- shutdownasap.in | 13 +++++++++++-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/shutdownasap.conf.in b/shutdownasap.conf.in index 7275c1e..3795467 100755 --- a/shutdownasap.conf.in +++ b/shutdownasap.conf.in @@ -10,16 +10,20 @@ pidFile="/tmp/shutdownasap.pid" waitForDir="/home/shutdown/.warteauf" # list of processes which must not be running before shutdown -declare -A shutDownNoGos - -shutDownNoGos["backup"]="[^/ ]*backup" -shutDownNoGos["dd"]="dd" -shutDownNoGos["ncat"]="ncat" -shutDownNoGos["ports"]="ports" -shutDownNoGos["prt-get"]="prt-get" -shutDownNoGos["rsync"]="rsync" -shutDownNoGos["wget"]="wget" -shutDownNoGos["wetter"]="/tmp/wetter.pid" +declare -A shutDownNoGoProcesses + +shutDownNoGoProcesses["backup"]="[^/ ]*backup" +shutDownNoGoProcesses["dd"]="dd" +shutDownNoGoProcesses["ncat"]="ncat" +shutDownNoGoProcesses["ports"]="ports" +shutDownNoGoProcesses["prt-get"]="prt-get" +shutDownNoGoProcesses["rsync"]="rsync" +shutDownNoGoProcesses["wget"]="wget" + +# list of PID files whose processes must not be running before shutdown +declare -A shutDownNoGoFiles + +shutDownNoGoFiles["wetter"]="/tmp/wetter.pid" # hook to execute after start of shutdownasap, before watching above conditions beforeWatchHook() { diff --git a/shutdownasap.in b/shutdownasap.in index 378e70c..aef43c4 100755 --- a/shutdownasap.in +++ b/shutdownasap.in @@ -42,15 +42,24 @@ do fi done - for s in "${!shutDownNoGos[@]}" + for s in "${!shutDownNoGoProcesses[@]}" do - if [ -e "${shutDownNoGos[${s}]}" ] || echo "${prozesse}" | grep -q "\(\s\|/\)${shutDownNoGos[${s}]}\(\$\|\s\)" + if echo "${prozesse}" | grep -q "\(\s\|/\)${shutDownNoGoProcesses[${s}]}\(\$\|\s\)" then nochwarten=true echo "prozess: ${s}" fi done + for s in "${!shutDownNoGoFiles[@]}" + do + if [ -e "${shutDownNoGoFiles[${s}]}" ] && echo "${prozesse}" | grep -q "^\S\+\s\+$(cat "${shutDownNoGoFiles[${s}]}")\s" + then + nochwarten=true + echo "datei: ${s}" + fi + done + if ${nochwarten} then echo "warten ..." -- cgit v1.2.3-70-g09d2