[SunHELP] Killing processes Part Deux
Vinay Bharel
sunhelp at sunhelp.org
Tue Feb 27 16:29:35 CST 2001
Which ps are you using? Do `which ps`. If you are using /usr/ucb/ps then
ps -e will not work. You will have to use ps -x .
There is /usr/ucb/ps and /usr/bin/ps. Looks like you are using
/usr/ucb/ps.
- Vinay Bharel <vinay at bharel.com>
On 27 Feb 2001, David Bishop wrote:
> Umm.. Again, it killed one batch while leaving the other batch alone.
> However, this time it wouldn't kill the second batch at all, just giving that
> bad argument count error.
>
> bash-2.04$ ps -auxw | grep datd | grep -v grep
> wwwpe 2819 0.0 0.5 4176 2536 pts/0 S 12:53:16 0:00
> /usr/usr3/bin/datd
> wwwpe 2823 0.0 0.2 4096 896 pts/0 S 12:53:16 0:00
> /usr/usr3/bin/datd
> wwwpe 2824 0.0 0.2 4096 896 pts/0 S 12:53:16 0:00
> /usr/usr3/bin/datd
> wwwpe 2825 0.0 0.2 4096 896 pts/0 S 12:53:16 0:00
> /usr/usr3/bin/datd
> wwwpe 2826 0.0 0.2 4136 1056 pts/0 S 12:53:16 0:00
> /usr/usr3/bin/datd
> wwwpe 2827 0.0 0.2 4136 1080 pts/0 S 12:53:16 0:00
> /usr/usr3/bin/datd
> wwwpe 7441 0.0 0.2 3072 808 pts/0 S 14:16:28 0:00
> /usr/usr3/bin/datd
> wwwpe 7442 0.0 0.2 3072 808 pts/0 S 14:16:28 0:00
> /usr/usr3/bin/datd
> wwwpe 7443 0.1 0.2 3072 808 pts/0 S 14:16:28 0:00
> /usr/usr3/bin/datd
> wwwpe 7444 0.0 0.2 3112 992 pts/0 S 14:16:28 0:00
> /usr/usr3/bin/datd
> wwwpe 7445 0.1 0.2 3112 1072 pts/0 S 14:16:28 0:00
> /usr/usr3/bin/datd
>
> bash-2.04$ ps -e | grep datd | grep -v grep | awk '{print $1}' | xargs kill
> -9
> bash-2.04$ ps ax | grep datd
> 2819 pts/0 S 0:00 /usr/usr3/bin/datd
> 7441 pts/0 S 0:00 /usr/usr3/bin/datd
> 7442 pts/0 S 0:00 /usr/usr3/bin/datd
> 7443 pts/0 S 0:00 /usr/usr3/bin/datd
> 7444 pts/0 S 0:00 /usr/usr3/bin/datd
> 7445 pts/0 S 0:00 /usr/usr3/bin/datd
> 7534 pts/0 R 0:00 grep datd
> bash-2.04$ ps -e | grep datd | grep -v grep | awk '{print $1}' | xargs kill
> -9
> /usr/bin/kill[8]: kill: bad argument count
> bash-2.04$ ps ax | grep datd
> 2819 pts/0 S 0:00 /usr/usr3/bin/datd
> 7441 pts/0 S 0:00 /usr/usr3/bin/datd
> 7442 pts/0 S 0:00 /usr/usr3/bin/datd
> 7443 pts/0 S 0:00 /usr/usr3/bin/datd
> 7444 pts/0 S 0:00 /usr/usr3/bin/datd
> 7445 pts/0 S 0:00 /usr/usr3/bin/datd
> 7560 pts/0 R 0:00 grep datd
> bash-2.04$ ps -e | grep datd | grep -v grep | awk '{print $1}'
> bash-2.04$
>
>
> On Tue, 27 Feb 2001 15:38:35 -0500 (EST), Vinay Bharel said:
>
> > You are making it too complicated. If you want to kill all processes named
> > foo, just do...
> >
> > ps -e | grep foo | grep -v grep | awk '{print $1}' | xargs kill -9
> >
> > - Vinay Bharel <vinay at bharel.com>
> >
> > On 27 Feb 2001, David Bishop wrote:
> >
> > > 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
> > >
> >
> > _______________________________________________
> > 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