init.d: add message when process unexpectedly terminated [#METR-14003]

This commit is contained in:
Pavel Kartavyy 2014-12-01 20:42:39 +03:00
parent 970d316b00
commit 2544b901a3

View File

@ -207,7 +207,15 @@ case "$1" in
disable_cron && stop
;;
status)
any_runs && echo "$PROGRAM service is running($(running_processes) of $NUMBER_OF_PROCESSES)" || echo "$PROGRAM service is stopped"
if [[ $(running_processes) -eq $NUMBER_OF_PROCESSES ]]; then
echo "$PROGRAM service is running"
else
if [ ! -e $LOCKFILE ]; then
echo "$PROGRAM service is stopped";
else
echo "$(($NUMBER_OF_PROCESSES - $(running_processes))) processes unexpectedly terminated"
fi
fi
;;
restart)
restart && enable_cron