From a7d2282fd0598829dcde5781c766388bc01fa2d7 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 2 Jan 2012 12:08:33 +0000 Subject: [PATCH] Make "/etc/init.d/scst status" exit with code 3 instead of 0 if SCST has not been started, as required by the LSB. Fixes a bug introduced in r3805. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4047 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/init.d/scst | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scstadmin/init.d/scst b/scstadmin/init.d/scst index 6e3648c2f..ea5cfcaf4 100755 --- a/scstadmin/init.d/scst +++ b/scstadmin/init.d/scst @@ -82,6 +82,20 @@ SCST_CFG=/etc/scst.conf if [ ! -e /lib/lsb/init-functions ]; then # Slackware and Gentoo. +rc_status() { + _rc_status_ret=$? + for i; do + case "$i" in + -v) + case "${_rc_status_ret}" in + 0) echo "OK";; + *) echo "Not running";; + esac + ;; + esac + done + return ${_rc_status_ret} +} start_daemon() { "$@" >/dev/null 2>&1 & } @@ -314,14 +328,9 @@ case "$1" in status) ## Print the current status of the service. echo -n "SCST status: " - scst_status - rc=$? - if [ $rc = 0 ]; then - echo "OK" - else - echo "Not running" - fi - exit 0 + scst_status >/dev/null 2>&1 + rc_status -v + exit $? ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"