diff --git a/fm-rest-api/fm/scripts/fm-api b/fm-rest-api/fm/scripts/fm-api index bf685411..2d5109ab 100644 --- a/fm-rest-api/fm/scripts/fm-api +++ b/fm-rest-api/fm/scripts/fm-api @@ -39,18 +39,15 @@ export PATH status() { - # Status function has a standard set of return codes to indicate daemon status - # http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html - - local my_processes=`pgrep -l -f "^(python|/usr/bin/python|/usr/bin/python2|/usr/bin/python3) ${DAEMON}([^\w-]|$)"` - - if [ -z "${my_processes}" ]; then - echo "$NAME is not running" - return 1 + pid=`cat $PIDFILE 2>/dev/null` + if [ -n "$pid" ]; then + if ps -p $pid | grep $NAME &> /dev/null ; then + echo "$NAME is running" + return 0 + fi fi - - echo "$NAME is running" - return 0 + echo "$NAME is not running" + return 1 } start () @@ -82,12 +79,12 @@ start () confirm_stop() { - local my_processes=`pgrep -l -f "^(python|/usr/bin/python|/usr/bin/python2|/usr/bin/python3) ${DAEMON}([^\w-]|$)"` + local my_processes=`pgrep -l -f "^(python|/usr/bin/python|/usr/bin/python2|/usr/bin/python3|/usr/libexec/platform-python) ${DAEMON}([^\w-]|$)"` if [ -n "${my_processes}" ] then logger -t $NAME "About to SIGKILL the following: ${my_processes}" - pkill -KILL -f "^(python|/usr/bin/python|/usr/bin/python2) ${DAEMON}([^\w-]|$)" + pkill -KILL -f "^(python|/usr/bin/python|/usr/bin/python2|/usr/bin/python3|/usr/libexec/platform-python) ${DAEMON}([^\w-]|$)" fi }