[PATCH] init script: be LSB compliant for exit code on status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <florian@xxxxxxxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux