From c9e24a0494dc499728e5131d15a8a16d3fd97c5d Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sat, 18 Apr 2009 00:09:03 +0000 Subject: Move status to runscript.sh so init scripts can override it, #159 Return 32 if crashed, #163 --- sh/runscript.sh.in | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'sh') diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index f48d0f8d..aaac4330 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -45,6 +45,31 @@ describe() done } +# Report status +status() +{ + if service_stopping; then + ewarn "status: stopping" + return 4 + elif service_starting; then + ewarn "status: starting" + return 8 + elif service_inactive; then + ewarn "status: inactive" + return 16 + elif service_started; then + if service_crashed; then + eerror "status: crashed" + return 32 + fi + einfo "status: started" + return 0 + else + einfo "status: stopped" + return 1 + fi +} + # Template start / stop functions start() { @@ -134,7 +159,7 @@ unset _f while [ -n "$1" ]; do # See if we have the required function and run it - for _cmd in describe start stop ${extra_commands:-${opts}} \ + for _cmd in describe start stop status ${extra_commands:-${opts}} \ ${extra_started_commands}; do if [ "${_cmd}" = "$1" ]; then if [ "$(command -v "$1")" = "$1" ]; then -- cgit v1.2.3