From 48df71c854b1c315f2ec66d067e9d0450a9a6068 Mon Sep 17 00:00:00 2001 From: Florian Haas Date: Tue, 27 Dec 2011 11:43:47 +0100 Subject: [PATCH] init script: be LSB compliant for exit code on status 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 --- src/init-ceph.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/init-ceph.in b/src/init-ceph.in index 0a70cd78ebe2e..701701f2f1ebb 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 ;; -- 2.39.5