[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Find and stop processes
From: |
John McKown |
Subject: |
Re: [Help-bash] Find and stop processes |
Date: |
Tue, 6 Dec 2016 06:57:11 -0600 |
On Tue, Dec 6, 2016 at 6:45 AM, Danny <address@hidden> wrote:
> Hi,
>
> I currently have some scripts that are executed via procmail which works just
> fine. Just one little issue though, I have no way (apart from doing it
> manually)
> of stopping all of them with one command.
>
> All the scripts are named like this -> "parameters_probe_*.php" (where the *
> is
> the numerical position of the probe).
>
> Is there a way I can search for these filenames (like this):
> ps -ax | grep "parameters_probe" then isolate the process ID and then kill
> them
> one by one?
>
> Hope I am making sense.
I think you are. Have you looked at the "killall" command?
killall -r 'parameters_probe_[[:digit:]]+\.php'
The value after the "-r" is a regular expression which need to match
the script name as shown in the "ps" command. You can include a "-i"
switch if you want to be asked to confirm each termination (like "rm
-i" does for deleting files).
>
> Thank you
>
> Danny
>
--
Heisenberg may have been here.
Unicode: http://xkcd.com/1726/
Maranatha! <><
John McKown