Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Delay watchdog checks while any other nsm_sensor_ps script runs #21

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions usr/lib/nsmnow/lib-nsm-common-utils
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,26 @@ process_restart_if_stale()
APP_DESC=${5:-}
USER=${6:-}

# don't run while any other nsm_sensor_ps script is running
if [ $(pgrep -c nsm_sensor_ps) -gt 1 ]
then
echo_msg_begin 1 "waiting for other nsmnow process control script to stop"
sleep 1
loop=2
while [ $(pgrep -c nsm_sensor_ps) -gt 1 ]
do
if [ $loop -ge 30 ]
then
echo_msg_end 1 "aborting after $loop checks"
echo "nsm_sensor_ps process_restart_if_stale function call exited with error" 1>&2
exit 1
fi
sleep 1
loop=$((loop + 1))
done
echo_msg_end 2 "continuing after $loop checks"
fi

# check for PID file
if [ -f $PID_FILE ]
then
Expand Down