From 83e1a14664478ca546f0a4362c931d25f11fcf6f Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Mon, 5 May 2008 17:55:21 +0000 Subject: [PATCH] Bug 337483. Modify micasad script to report correct status. --- CASA/CASA.changes | 6 ++++++ CASA/micasad/startup/micasad | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/CASA/CASA.changes b/CASA/CASA.changes index a0854b5b..18e2b5da 100644 --- a/CASA/CASA.changes +++ b/CASA/CASA.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon May 5 11:51:53 MDT 2008 - jnorman@novell.com + +- Bug 337483. Modify micasad script to report + correct status. + ------------------------------------------------------------------- Wed Apr 16 15:46:50 MDT 2008 - jnorman@novell.com diff --git a/CASA/micasad/startup/micasad b/CASA/micasad/startup/micasad index 3054f4b9..251f3256 100644 --- a/CASA/micasad/startup/micasad +++ b/CASA/micasad/startup/micasad @@ -36,13 +36,41 @@ function pid_exists() function process_running() { - kill -0 `cat /var/run/micasad.pid` 2> /dev/null + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + # Return value is slightly different for the status command: + # 0 - service up and running + # 1 - service dead, but /var/run/ pid file exists + # 2 - service dead, but /var/lock/ lock file exists + # 3 - service not running (unused) + # 4 - service status unknown :-( + # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) + + # NOTE: checkproc returns LSB compliant status values. + # checkproc $MICASAD_BIN + # NOTE: rc_status knows that we called this init script with + # "status" option and adapts its messages accordingly. + + MICASAD_PROC=`ps -eo pid,cmd | grep /usr/bin/micasad.exe | grep -v grep | cut -d ' ' -f1` + echo $MICASAD_PROC + if [ -z $MICASAD_PROC ] + then + MICASAD_PROC=`ps -eo pid,cmd | grep -v grep | grep /usr/bin/micasad.exe | cut -d ' ' -f2` + fi + + if [ -n "$MICASAD_PROC" ] + then + return 0 + else + return 1 + fi + rc_status -v } function is_running() { pid_exists && process_running - } case "$1" in