From 27bb4e72ea41d86efa0478d27026f80e2cc4a75f Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 24 Sep 2008 10:07:34 -0400 Subject: Use the pidfile before running pidof in status(). (#463205) This matches the behavior of killproc. --- rc.d/init.d/functions | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 7a66840c..acef3321 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -380,15 +380,17 @@ status() { base=${1##*/} # First try "pidof" - pid="$(__pids_pidof "$1")" + __pids_var_run "$1" "$pid_file" + RC=$? + if [ -z "$pid_file" -a -z "$pid" ]; then + pid="$(__pids_pidof "$1")" + fi if [ -n "$pid" ]; then echo $"${base} (pid $pid) is running..." return 0 fi - # Next try "/var/run/*.pid" files - __pids_var_run "$1" "$pid_file" - case "$?" in + case "$RC" in 0) echo $"${base} (pid $pid) is running..." return 0 -- cgit v1.2.1