Module: check_mk
Branch: master
Commit: b334e12eef275766117a107ca300825d603480ba
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b334e12eef2757…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 31 16:50:37 2013 +0100
Fixed small problems with mkeventd initscript
---
mkeventd/omd/mkeventd.init | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/mkeventd/omd/mkeventd.init b/mkeventd/omd/mkeventd.init
index 4e6237a..6b402b3 100755
--- a/mkeventd/omd/mkeventd.init
+++ b/mkeventd/omd/mkeventd.init
@@ -32,17 +32,24 @@ case "$1" in
echo 'Not running.'
else
echo -n "killing $THE_PID..."
- kill $THE_PID
- N=0
- while [ -e "$PIDFILE" ] ; do
- sleep 0.5
- echo -n .
- N=$((N + 1))
- if [ $N -gt 20 ] ; then
- echo "PID file did not vanish."
- exit 1
- fi
- done
+ kill $THE_PID 2>/dev/null
+ if [ $? -eq 0 ]; then
+ # Only wait for pidfile removal when the signal could be sent
+ N=0
+ while [ -e "$PIDFILE" ] ; do
+ sleep 0.5
+ echo -n .
+ N=$((N + 1))
+ if [ $N -gt 20 ] ; then
+ echo "PID file did not vanish."
+ exit 1
+ fi
+ done
+ else
+ # Remove the stale pidfile to have a clean state after this
+ rm $PIDFILE
+ fi
+ echo 'OK'
fi
;;
restart)