[SunHELP] Killing processes Part Deux

Nicholas Dronen sunhelp at sunhelp.org
Tue Feb 27 17:33:34 CST 2001


This may not be the ultimate answer, but you shouldn't do

for i in [ list ]
do `kill $i`
done

Rather, remove the backticks.

for i in [ list ] ; do
	kill $i 
done

I don't know if what you sent to the list is port mortem
output or the real thing, but your use of backticks stuck
out to me.


On Tue, Feb 27, 2001 at 03:29:30PM -0700, David Bishop wrote:
> Worked like a charm.  See, this is why I love this list :-)  Now, it's simply
> curiosity that makes me ask why the do loop wasn't working.  And I can sleep
> tonight if I can't figure it out ;-)
> 
> On Tue, 27 Feb 2001 21:34:02, Jarrett Carver said:
> 
> > 
> >  Is `fuser -k /usr/usr3/bin/datd` not working?
> >  
> >  ----Original Message Follows----
> >  From: "David Bishop" <david at bishop.dhs.org>
> >  Reply-To: sunhelp at sunhelp.org
> >  To: sunhelp at sunhelp.org
> >  Subject: [SunHELP] Killing processes Part Deux
> >  Date: 27 Feb 2001 13:00:10 MST
> >  
> >  So, the pkill command works *wonderfully* ... on my Solaris 7 boxen.
> >  However, I have the same problem on Solaris 2.6, and it's giving me fits.  I
> >  sat down and came up with a wonderfully simple way to do this in bourne
> >  shell, but for some reason, it doesn't consistently work.  Any ideas?
> >  
> >  
> >  bash-2.04$ a=`ps ax | grep datd | grep -v grep | cut -f3 -d" "`
> >  bash-2.04$ echo $a
> >  7713 7754 7755 7759 7761 7762 9057 9058 9059 9060 9061
> >  bash-2.04$ for i in $a
> >   > do `kill $i`
> >   > done
> >  bash-2.04$ ps ax | grep datd
> >     7713 ?	S  0:00 /usr/usr3/bin/datd
> >     7754 ?	S  0:00 /usr/usr3/bin/datd
> >     7755 ?	S  0:00 /usr/usr3/bin/datd
> >     7759 ?	S  0:00 /usr/usr3/bin/datd
> >     7761 ?	S  0:00 /usr/usr3/bin/datd
> >     7762 ?	S  0:00 /usr/usr3/bin/datd
> >     2769 pts/0	R  0:00 grep datd
> >  bash-2.04$ a=`ps ax | grep datd | grep -v grep | cut -f3 -d" "`
> >  bash-2.04$ for i in $a; do `kill $i`; done
> >  bash-2.04$ ps ax | grep datd
> >  
> >  So, there was two "sections" of datd running, first with pid's in the 77xx
> >  range, and then in the 90xx range.  The first do loop only killed the 90xx
> >  section, but doing the exact same thing resulted in the 77xx section dieing
> >  the second time.  I'll admit, I'm confused.  And this *is* replicable
> >  behavior, it happens every time.  Is there something obvious that I'm
> >  missing, or is this a known bug?
> >  
> >  TIA and HAND,
> >  
> >  D.A.Bishop
> >  _______________________________________________
> >  SunHELP maillist  -  SunHELP at sunhelp.org
> >  http://www.sunhelp.org/mailman/listinfo/sunhelp
> >  
> >  _________________________________________________________________
> >  Get your FREE download of MSN Explorer at http://explorer.msn.com
> >  
> >  _______________________________________________
> >  SunHELP maillist  -  SunHELP at sunhelp.org
> >  http://www.sunhelp.org/mailman/listinfo/sunhelp
> >  
> >  
> 
> _______________________________________________
> SunHELP maillist  -  SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list