Revision 6661ea25
Added by Andrew Thompson about 15 years ago
etc/inc/service-utils.inc | ||
---|---|---|
146 | 146 |
|
147 | 147 |
function is_pid_running($pidfile) { |
148 | 148 |
$pid = trim(file_get_contents($pidfile)); |
149 |
$running = (trim(shell_exec("ps -p {$pid}")) != '');
|
|
149 |
$running = (trim(shell_exec("/usr/bin/procstat {$pid} 2>/dev/null")) != '');
|
|
150 | 150 |
return $running; |
151 | 151 |
} |
152 | 152 |
|
etc/inc/util.inc | ||
---|---|---|
50 | 50 |
} |
51 | 51 |
|
52 | 52 |
function is_process_running($process) { |
53 |
$running = (shell_exec("pgrep -x {$process}") != ''); |
|
53 |
$running = (shell_exec("/bin/pgrep -x {$process}") != '');
|
|
54 | 54 |
|
55 | 55 |
return $running; |
56 | 56 |
} |
Also available in: Unified diff
Use procatat instead of ps as the latter always prints a header, also
use full paths.