From 37ef3ec2886ab6bd0e2a3c7df30ee139736f83c4 Mon Sep 17 00:00:00 2001 From: Schakko Date: Mon, 28 Sep 2015 14:02:57 +0200 Subject: [PATCH] Added 'status' argument for monitord-start-stop --- scripts/monitord-start-stop | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/scripts/monitord-start-stop b/scripts/monitord-start-stop index 3c3fd43..75497da 100644 --- a/scripts/monitord-start-stop +++ b/scripts/monitord-start-stop @@ -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 @@ -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