Skip to content

Commit

Permalink
Added 'status' argument for monitord-start-stop
Browse files Browse the repository at this point in the history
  • Loading branch information
schakko committed Sep 28, 2015
1 parent c427d37 commit 37ef3ec
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion scripts/monitord-start-stop
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,33 @@ restart() {
start
}

status() {
if [ -f $pidfile ]
then
pid=`cat $pidfile`

if [ "x$pid" != "x" ]
then
pidtest=`ps aux | grep "monitord" | grep -v "grep" | grep -v "monitord status"`

if [ "x$pidtest" = "x" ]
then
rm -f $pidfile
echo "Removed stale pid file $pidfile"
pid=""
else
echo "Monitord running"
return 0
fi

fi
fi

echo "Monitord not started"
exit 1
}


case "$1" in
start)
start
Expand All @@ -113,8 +140,11 @@ case "$1" in
restart)
restart
;;
status)
status
;;
*)
echo $"Usage: $0 (start|stop|restart)"
echo $"Usage: $0 (start|stop|restart|status)"
exit 2
esac

Expand Down

0 comments on commit 37ef3ec

Please sign in to comment.