We would like to check if a specified process is currently running via PHP.
We would like to simply supply a PID and see if it is currently executing or not.
Here is how we do it:
if (`ps -p {$pid} -o comm,args=ARGS | grep php`) {
//process with pid=$pid is running;
}
I would call a bash script using shell_exec
$pid = 23818;
if (shell_exec("ps aux | grep " . $pid . " | wc -l") > 0)
{
// do something
}
posix_getpgid($pid);
will return false when a process is not running