Improve statusproc output when process is not running
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 31 Aug 2013 15:38:10 +0000 (11:38 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 31 Jul 2014 02:15:24 +0000 (22:15 -0400)
stage1/bootscripts/functions
stage4/bootscripts/dbus
stage5/bootscripts/clamav

index f7dfc18..4a436e0 100644 (file)
@@ -449,7 +449,7 @@ reloadproc()
 
        if [ ${?} -ne 0 ]; then
            sleep 2
-           if statusproc ${base} | grep -q "not running"; then
+           if statusproc ${base} | grep -q "stopped"; then
                return ${EXIT_CODE_FAILURE}
            fi
        fi
@@ -510,10 +510,11 @@ statusproc_path()
     if [ -f ${piddir}/${base}.pid ]; then
        pid=$(head -1 ${piddir}/${base}.pid)
        if [ -n "${pid}" ]; then
-           echo "${base} not running but ${piddir}/${base}.pid exists"
+           echo "${base} stopped but ${piddir}/${base}.pid exists"
            return ${EXIT_CODE_FAILURE}
        fi
-    else
-       echo "${base} is not running"
     fi
+
+    echo "${base} is stopped"
+    return ${EXIT_CODE_FAILURE}
 }
index 0efaa69..d4c77f5 100755 (executable)
@@ -12,7 +12,7 @@ DAEMON_DESC="D-BUS Messagebus daemon"
 DAEMON_OPTS="--config-file=/etc/dbus-1/system.conf"
 
 dbus_start() {
-    if statusproc ${DAEMON} | grep -q "not running"; then
+    if statusproc ${DAEMON} | grep -q "stopped"; then
        if [ -f /var/run/dbus/pid ]; then
            rm /var/run/dbus/pid
        fi
index 32f32a0..4ecc4f0 100755 (executable)
@@ -9,7 +9,7 @@ SOCKET_DIR="/var/run/clamav"
 
 start()
 {
-    if statusproc clamd | grep -q "not running"; then
+    if statusproc clamd | grep -q "stopped"; then
        # Not taking any chances, removing left-over files
        rm -f ${SOCKET_DIR}/clamd.{sock,pid} || return 1
     fi
@@ -17,7 +17,7 @@ start()
 
     sleep 1
 
-    if statusproc clamav-milter | grep -q "not running"; then
+    if statusproc clamav-milter | grep -q "stopped"; then
        # Not taking any chances, removing left-over files
        rm -f ${SOCKET_DIR}/clmilter.sock || return 1
     fi