Commit c46cee45 authored by Franco Fichtner's avatar Franco Fichtner

inc: don't send signal to stale process; fixes #159

parent 941321de
...@@ -37,7 +37,7 @@ function killbyname($procname, $sig = 'TERM') ...@@ -37,7 +37,7 @@ function killbyname($procname, $sig = 'TERM')
function killbypid($pidfile, $sig = 'TERM') function killbypid($pidfile, $sig = 'TERM')
{ {
if (!file_exists($pidfile)) { if (!isvalidpid($pidfile)) {
return; return;
} }
...@@ -46,12 +46,11 @@ function killbypid($pidfile, $sig = 'TERM') ...@@ -46,12 +46,11 @@ function killbypid($pidfile, $sig = 'TERM')
function isvalidpid($pidfile) function isvalidpid($pidfile)
{ {
$output = ""; if (!file_exists($pidfile)) {
if (file_exists($pidfile)) { return false;
exec("/bin/pgrep -nF {$pidfile}", $output, $retval);
return (intval($retval) == 0);
} }
return false;
return mwexecf('/bin/pgrep -nF %s', $pidfile) == 0;
} }
function is_process_running($process) function is_process_running($process)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment