[wplug] Killing processes
Bill Moran
wmoran at potentialtech.com
Wed Nov 26 09:25:00 EST 2003
Andreas Rindler wrote:
> Hey,
> I am having trouble restarting Evolution after my network connection has
> either changed or was terminated. It leaves two process running and I
> can't restart Evolution. My solution so far was to kill these processes
> which lets me restart it.
>
> I am trying to automate this, but I can't quite get the syntax to work:
>
> ps aux | grep evolutio n| awk '{print$2}'
>
> #gives me all processes that have evolution in the name
>
> ps aux | grep evolution | awk '{print$2}' | kill
>
> #and then the idea was to just pipe it to kill, but it doesn't work
> #also, the third process is the grep command itself, how do i skip that
> one??
>
> I would be grateful for any ideas...
kill `ps aux | grep evolution | grep -v grep | awk '{print$2}'`
The backquotes cause the output of the command to be used as the argument
to kill. grep -v only shows lines that don't match. I don't know how
cross-shell compatable this is, so apologies if it doesn't work in whatever
shell you're using.
--
Bill Moran
Potential Technologies
http://www.potentialtech.com
More information about the wplug
mailing list