Roger W.
Roger W.

Reputation: 337

Killing specific PHP process

How do you kill a PHP process running a specific script?.

I have several cronjobs that run different php scripts every hour. So let's say I have cron1.php, cron2.php and cron3.php. Whenever I run cron2.php, I want to kill all running instances of PHP executing THAT one script (and not cron1.php or cron3.php). I could do "killall php" but that will stop all of them.

Upvotes: 1

Views: 2185

Answers (1)

Roger W.
Roger W.

Reputation: 337

kill `pgrep -f cron2.php`

Thanks to Waleed Khan for showing the right path

Upvotes: 3

Related Questions