how to kill all the processes under a particular user

how to kill all the processes under a particular user

Post by Mark O. Schlege » Sun, 24 Jun 2001 13:34:27



When I use make to compile a project, there are usually about
10 or 12 processes spawned.  How can the entire make be stopped?

Today I needed to stop such a job and it was difficult to
stop the make because new child processes would constantly
fork off. I tried to kill the job with the oldest wall
time but this didn't seem to work, eventually I killed
the right one by accident. Is there a way to figure
out which process to kill so that all the children would
be taken down too?

Mark

 
 
 

how to kill all the processes under a particular user

Post by Tim Hayne » Sun, 24 Jun 2001 19:21:46



Quote:> When I use make to compile a project, there are usually about 10 or 12
> processes spawned. How can the entire make be stopped?

> Today I needed to stop such a job and it was difficult to stop the make
> because new child processes would constantly fork off. I tried to kill
> the job with the oldest wall time but this didn't seem to work,
> eventually I killed the right one by accident. Is there a way to figure
> out which process to kill so that all the children would be taken down
> too?

What unix are you using?

You'd find it easiest by far if you use _pstree_ (with `-p' option); on
some boxen, `ps -ef' will show the PPID, so you can work your way up from
there.

~Tim
--

West winds blow.                            |http://spodzone.org.uk/

 
 
 

how to kill all the processes under a particular user

Post by Mark O. Schlege » Sun, 24 Jun 2001 23:02:18




> > When I use make to compile a project, there are usually about 10 or 12
> > processes spawned. How can the entire make be stopped?

> > Today I needed to stop such a job and it was difficult to stop the make
> > because new child processes would constantly fork off. I tried to kill
> > the job with the oldest wall time but this didn't seem to work,
> > eventually I killed the right one by accident. Is there a way to figure
> > out which process to kill so that all the children would be taken down
> > too?

> What unix are you using?

> You'd find it easiest by far if you use _pstree_ (with `-p' option); on
> some boxen, `ps -ef' will show the PPID, so you can work your way up from
> there.

> ~Tim

Solaris 8, plus I was doing the compile via an 'at' job that runs a
shell script to do the checkouts and compiling.  That might make a
difference because the processes might not have a terminal then?
I was just figuring there should be a way for ps aux under solaris to
tell you which process is the parent that then started the childs,
is it right that in unix if you kill the parent the children
get signaled to die too or is that wrong?

Mark

 
 
 

how to kill all the processes under a particular user

Post by Tim Hayne » Sun, 24 Jun 2001 23:33:20



[snip]

Quote:> > What unix are you using?

> > You'd find it easiest by far if you use _pstree_ (with `-p' option); on
> > some boxen, `ps -ef' will show the PPID, so you can work your way up from
> > there.

> Solaris 8,

Ah. Me no Solaris 8, but I'll point you in the right direction until
someone comes up with a better idea :)

Quote:> plus I was doing the compile via an 'at' job that runs a shell script to
> do the checkouts and compiling. That might make a difference because the
> processes might not have a terminal then?

Not really. They're still inheriting cc from make from a shell, or whatever
the nature of the compile is.

Quote:> I was just figuring there should be a way for ps aux under solaris to
> tell you which process is the parent that then started the childs,

What about `ps -efo pid,ppid,args', or some variant (the -efo might or
might not work for you).

Quote:> is it right that in unix if you kill the parent the children get signaled
> to die too or is that wrong?

Yes, they should get signalled, but I would always prepare for them to
studiously ignore your signalling - kill them as well in one nice long kill
command to be sure.

~Tim
--

All our roads are waiting / To be revealed  |http://spodzone.org.uk/

 
 
 

how to kill all the processes under a particular user

Post by Adam Gibso » Tue, 26 Jun 2001 04:52:00


Just an additional contribution:
/usr/ucb/ps -auxww will definitely give PID and PPID (parentPID) for you
under Solaris (unless they dropped this from Solaris 8, I'm using 2.6, but I
doubt that).
So if you want, you can write a script to kill the parent and all children
using that info. I did something similar a couple of months back.
On the subject of 'cascading kill', as I recall, it depends on the type of
signal sent, but that there is at least one annoying complication ... sorry
but my recollection is hazy.

Regards,
Adam



> [snip]
> > > What unix are you using?

> > > You'd find it easiest by far if you use _pstree_ (with `-p' option);
on
> > > some boxen, `ps -ef' will show the PPID, so you can work your way up
from
> > > there.

> > Solaris 8,

> Ah. Me no Solaris 8, but I'll point you in the right direction until
> someone comes up with a better idea :)

> > plus I was doing the compile via an 'at' job that runs a shell script to
> > do the checkouts and compiling. That might make a difference because the
> > processes might not have a terminal then?

> Not really. They're still inheriting cc from make from a shell, or
whatever
> the nature of the compile is.

> > I was just figuring there should be a way for ps aux under solaris to
> > tell you which process is the parent that then started the childs,

> What about `ps -efo pid,ppid,args', or some variant (the -efo might or
> might not work for you).

> > is it right that in unix if you kill the parent the children get
signaled
> > to die too or is that wrong?

> Yes, they should get signalled, but I would always prepare for them to
> studiously ignore your signalling - kill them as well in one nice long
kill
> command to be sure.

> ~Tim
> --
> The sun is melting over the hills,


Quote:> All our roads are waiting / To be revealed  |http://spodzone.org.uk/

______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net