X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fdeployments%2Faots-adml%2Fstop.sh;fp=example%2Fdiameter%2Flauncher%2Fdeployments%2Faots-adml%2Fstop.sh;h=a4f1121bff942bb87010981b6b6ba9052a948571;hb=2f2cc741b21502b2bd37060a1059084a54cb8b6e;hp=0000000000000000000000000000000000000000;hpb=a5d4c4f2e8bd10de42bb5a0bfa20acaceaf2e67a;p=anna.git diff --git a/example/diameter/launcher/deployments/aots-adml/stop.sh b/example/diameter/launcher/deployments/aots-adml/stop.sh new file mode 100755 index 0000000..a4f1121 --- /dev/null +++ b/example/diameter/launcher/deployments/aots-adml/stop.sh @@ -0,0 +1,26 @@ +#!/bin/bash +function pgrep_live { + pids=$(pgrep "$1"); + [ "$pids" ] || return; + ps -o s= -o pid= $pids | sed -n 's/^[^ZT][[:space:]]\+//p'; +} +cd `dirname $0` +PID=$(pgrep_live ^ADML) +[ -z "$PID" ] && exit 0 +kill $PID + +# Protection to force kill (with SIGKILL) if ADML still alive after certain time: +seconds2force=3 +count=$((10*seconds2force)) +kill0=0 +while [ $kill0 -eq 0 -a $count -gt 0 ] +do + sleep 0.1 + count=$((count-1)) + kill -0 $PID 2>/dev/null + kill0=$? + echo -n . +done +[ $kill0 -eq 0 ] && { echo " sigkill to ADML pid $PID !" ; kill -9 $PID ; } +rm -f .pid +