Skip to content

Commit

Permalink
startstop: support of nachwaechter OK | FAIL
Browse files Browse the repository at this point in the history
startstop now reports process status for nachwaechter watching
  • Loading branch information
wwwutz committed Dec 12, 2024
1 parent 6788fc8 commit 6a5ee9a
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion startstop.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,42 @@ srv_generic_status() {
fi
}
srv_generic_okfail() {
local fail
fail=0
if [[ -s "\${PGIDFILE}" ]]; then
local pgid
read -a pgid < "\${PGIDFILE}"
local pids
pids=\$(pgrep -g \${pgid}||true)
if [[ -n \${pids} ]]; then
ps -f --no-headers --pid \${pids}>/dev/null||true
fail=\$?
else
fail=1
fi
if [[ \$fail != 0 ]]; then
echo "FAIL \${srv} processs group \${pgid} has no running processes for \${PGIDFILE}"
else
echo "OK \${srv}"
fi
else
if [[ -s "\${PIDFILE}" ]]; then
local pid
read -a pid < "\${PIDFILE}"
ps -f --pid \${pid} --ppid \${pid}>/dev/null||true
fail=\$?
else
fail=1
fi
if [[ \$fail != 0 ]]; then
echo "FAIL \${srv} no pgid or pid file found: \${PGIDFILE} \${PIDFILE}"
else
echo "OK \${srv}"
fi
fi
}
srv_generic_stop() {
if [[ -s "\${PGIDFILE}" ]]; then
local pgid
Expand Down Expand Up @@ -193,7 +229,7 @@ if [[ \${srv} = 'all' ]]; then
fi
for srv in \${_srv[@]}; do
echo "### ./startstop.sh \${cmd} \${srv}"
# echo "### ./startstop.sh \${cmd} \${srv}"
"${PROJECT}"/startstop.sh \${cmd} \${srv} || echo "RET: $?"
done
exit
Expand Down

0 comments on commit 6a5ee9a

Please sign in to comment.