cocur/background-process

Stop Process By ID

giselajesslim opened this issue · 1 comments

How to stop process by ID?
I am using stable version.
Thanks.

$process = new BackgroundProcess('/usr/bin/php queue.php');
        if ($process->isRunning(15371)) {
            $process->stop();
        }

BackgroundProcess handles the PID internally. The parameter you passed to isPassing() does actually do nothing. If you want to stop a process manually by PID you can check out the source code of the stop() method. See https://github.com/cocur/background-process/blob/master/src/BackgroundProcess.php#L94