NAMAssist
NAMAssist

Reputation: 381

How to kill multiple laravel php artisan commands at once?

Often when I update what's in my scheduled tasks, I need to remove what's already running. Is there a way to quickly remove them?

Currently I do this:

  1. Find the task IDs with this: ps -fe | grep artisan

  2. Kill the tasks like /usr/bin/php7.3 artisan command:my-commands-here and "sh -c ...etc.etc. artisan etc.etc" with a kill command like: kill 155431

Is there a linux command I can use to kill all "artisan command:XYZ" at once?

Upvotes: 0

Views: 2715

Answers (1)

Sakthivel A R
Sakthivel A R

Reputation: 585

Use the below command. It will kill each process listed in artisan search list.

for pid in $(ps -fe | grep artisan); do kill $pid; done

Upvotes: 2

Related Questions