diff options
author | thompsa <andy@fud.org.nz> | 2010-03-12 13:18:09 +1300 |
---|---|---|
committer | thompsa <andy@fud.org.nz> | 2010-03-12 13:18:09 +1300 |
commit | cae1b7db89f7cc46fb611701e8d261054903a3ad (patch) | |
tree | a9f1aee243de37efc9a3658ca01221dbcb362d54 /etc | |
parent | a3db8d75dd68362341d408c5369057eb22e869e2 (diff) | |
download | pfsense-cae1b7db89f7cc46fb611701e8d261054903a3ad.zip pfsense-cae1b7db89f7cc46fb611701e8d261054903a3ad.tar.gz |
'\b' is not the word boundary on BSD, its actually '[[:<:]]' and '[[:>:]]',
change these functions to use better syntax and not grep at all.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/service-utils.inc | 4 | ||||
-rw-r--r-- | etc/inc/util.inc | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 0d4c1e1..7a0eccf 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -146,7 +146,7 @@ function restart_service($name) { function is_pid_running($pidfile) { $pid = trim(file_get_contents($pidfile)); - $running = (trim(shell_exec("ps axwu | grep '\b{$pid}\b' | grep -v 'grep'")) != ''); + $running = (trim(shell_exec("ps -p {$pid}")) != ''); return $running; } @@ -195,4 +195,4 @@ function is_service_running($service, $ps = "") { } } -?>
\ No newline at end of file +?> diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 9bae752..686810f 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -50,7 +50,7 @@ function isvalidpid($pid) { } function is_process_running($process) { - $running = (trim(shell_exec("ps axwu | grep '\b{$process}\b' | grep -v 'grep'")) != ''); + $running = (shell_exec("pgrep -x {$process}") != ''); return $running; } |