diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2017-09-16 15:08:26 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2017-09-16 15:08:26 +0300 |
commit | 499f7d5015b3d31a8ad3b0e555e72916a846c2cb (patch) | |
tree | af4db12aefd4cca1cd39d97ae6d43b4192878db3 /include/functions | |
parent | ccf9db18f85e480ed18dfd2d502b23f017fd0767 (diff) |
Improve process detection
Diffstat (limited to 'include/functions')
-rw-r--r-- | include/functions | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/functions b/include/functions index 1f073112..e4036825 100644 --- a/include/functions +++ b/include/functions @@ -1245,10 +1245,15 @@ IsRunning() { if [ $# -eq 0 ]; then ExitFatal "Missing parameter when calling IsRunning function"; fi RUNNING=0 - PSOPTIONS=" -o args=" - if [ ${SHELL_IS_BUSYBOX} -eq 0 ]; then PSOPTIONS=" -o args= -C $1"; fi - FIND=$(${PSBINARY} ${PSOPTIONS} | egrep "( |/)$1" | grep -v "grep") - if [ ! "${FIND}" = "" ]; then + if [ ! -z "${PGREPBINARY}" ]; then + FIND=$(${PGREPBINARY} -x $1) + else + PSOPTIONS=" -o args=" + if [ ${SHELL_IS_BUSYBOX} -eq 0 ]; then PSOPTIONS=" -o args= -C $1"; fi + FIND=$(${PSBINARY} ${PSOPTIONS} | egrep "( |/)$1" | grep -v "grep") + fi + + if [ ! -z "${FIND}" ]; then RUNNING=1 LogText "IsRunning: process '$1' found (${FIND})" return 0 |