Trivial patch to fix init script LSB compliance
Hi everyone,
please consider merging the following trivial patch that makes the ceph init script return the proper LSB exit code (3) for the status action if the service is gracefully stopped, and only return 1 (as before) if the service has died and left its PID file hanging around.
Who cares about the exit code? Pacemaker does
(http://www.clusterlabs.org). Pacemaker is a high-availability resource manager that can be used for monitoring and recovering resources in-place, and as per a brief discussion in #ceph that I had with Greg before the holidays, no such in-place recovery currently exists within Ceph itself. Integrating init script based services with Pacemaker is trivial if the script complies with the exit codes that the LSB spec specifies.
Feedback on this is much appreciated. Hope this is useful.
Cheers,
Florian
[PATCH] init script: be LSB compliant for exit code on status
PATCH 1/1 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
--- src/init-ceph.in | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
src/init-ceph.in +6 -1
@@ -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 ;;
Signature · 1 line
1.7.5.4