Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-19-2005, 10:34 AM   #1
LQ Newbie
Registered: Jul 2005
Posts: 1

Rep: Reputation: 0
Process killing script

Hello everybody:

I am running a software which usually leaves undesired processes running after progam shutdown, always containing the directory where the binaries running are placed. I usually kill them by

> ps aux | grep my-
owix 28346 0.0 0.6 72608 6788 ? S 17:24 0:00 /work/my-release/my_dir/installed/i686-slc3-gcc323-opt/bin/rc_empty_controller
owix 28347 0.0 0.6 93220 6948 ? S 17:24 0:00 /work/my-release/my_dir/installed/i686-slc3-gcc323-opt/bin/rc_empty_controller -n RootController
owix 28575 0.0 0.0 4772 680 pts/5 S 17:27 0:00 grep my-

and then:

> kill -9 28347 28346

Then I would like to have an script which kill all the processes belonging to a specific user (owix) and that contains in the description the "my-release" pattern.
Do you have any idea about how to do this? Thanks you very much. Cheers,

Old 07-19-2005, 11:04 AM   #2
Registered: Aug 2003
Location: Edinburgh
Distribution: Server: Gentoo2004; Desktop: Ubuntu
Posts: 720

Rep: Reputation: 30
ps aux | grep my-owix > tempfile

then use awk to select the first colum from that temp file. Can't quite remember the code, but it iwll be something like:

awk '{ print $1 }' tempfile > temp2

then write a script to get the PID from temp2.

Old 07-19-2005, 11:08 AM   #3
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
ps aux|grep owix|grep [m]y-release|awk '{print $2}'|xargs kill -9

Last edited by demian; 07-19-2005 at 11:09 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating the "killing" process via a shell script fatrandy13 Linux - Software 5 09-13-2007 11:59 PM
killing a hung up process with a script lockejr Linux - General 2 04-13-2006 11:40 PM
Killing a process by its name rabeea Linux - Networking 3 03-17-2005 05:30 AM
Killing child process coolfrog Programming 3 09-28-2004 02:58 PM
Really Killing a Process! lazlow69 Linux - Newbie 14 05-10-2003 10:31 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:12 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration