An exit code of 1 on status is defined in LSB as
"program is dead, but pid file exists". Check for existence
of this pid file, and only set the exit status 1 if it's still there.
Set it to 3 ("program is not running") otherwise.

Reference: 
http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

Signed-off-by: Florian Haas <[email protected]>
---
 src/init-ceph.in |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/init-ceph.in b/src/init-ceph.in
index 0a70cd7..701701f 100644
--- a/src/init-ceph.in
+++ b/src/init-ceph.in
@@ -297,9 +297,14 @@ for name in $what; do
        status)
            if daemon_is_running $name ceph-$type $id $pid_file; then
                 echo "$name: running..."
-            else
+            elif [ -e "$pid_file" ]; then
+                # daemon is dead, but pid file still exists
                 echo "$name: dead."
                 EXIT_STATUS=1
+            else
+                # daemon is dead, and pid file is gone
+                echo "$name: not running."
+                EXIT_STATUS=3
             fi
            ;;
 
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to