From 4407d519f7866ba326eb5203514c8e547b162509 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Fri, 11 Sep 2015 10:35:20 +0200 Subject: service: improve status and stop function for daemon with intscripts When daemon abnormally dies systemd leaves it in active state. This is due to support of initscripts like network. We can guess if it is a daemon or not. --- rc.d/init.d/functions | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index f7d3ca93..430ac388 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -387,7 +387,14 @@ status() { if [ "$_use_systemctl" = "1" ]; then systemctl status ${0##*/}.service - return $? + ret=$? + # LSB daemons that dies abnormally in systemd looks alive in systemd's eyes due to RemainAfterExit=yes + # lets adjust the reality a little bit + if systemctl show -p ActiveState ${0##*/}.service | grep -q '=active$' && \ + systemctl show -p SubState ${0##*/}.service | grep -q '=exited$' ; then + ret=3 + fi + return $ret fi # First try "pidof" -- cgit v1.2.1