I received a ton of great responses. It was actually more help than I ever
would have thought....thanks you very much for that...
to all that responded I really appreciate it....
I chose to do option 3 below. All seem to be very good and very helpful. I
went with 3 because it was most similar to what I had already been doing.
Thank you very much for all your help.
These were the top responses
You can try:
1) kill -9 `ps -fae | grep "shell" | grep -v grep | cut -c10-18`
2) $ ps aux | grep csh | grep -v grep | awk '{print $2}' | xargs kill -9
3) list=`ps agh | grep shell | grep -v "grep shell" |awk '{print $2}'`
for x in $list ; do
kill $x
done
4) kill `ps agh | grep "[s]leep" | awk '{print $1}'`
will kill all processes running the command "sleep". The
"[s]leep"
keeps the grep process from finding its own PID and saves an
extra invocation of the grep command.
5)
#! /bin/csh -f
#
# L.Chiappetti - IFCTR - Dec 90
#
# Version 1.0 - Dec 90 - Original version
# Version 1.1 - Sep 96 - for Alpha Digital Unix
# different ps qualifiers
#
#
# The UNIQ INTERFACE package
#
# OFF kills processes by name
# if more processes exist then a
# listing is displayed and no action take
# one has to kill it by number
#
# if user is SU (home equal to root) ALL
# processes are considered, else only the
# caller's processes
#
if ("$HOME" == "/") then
set qualif = "-A -o
user,pid,pcpu,pmem,vsize,rssize,tname,state,start,ucomm"
else
set qualif = "-U $LOGNAME -o
user,pid,pcpu,pmem,vsize,rssize,tname,state,start,ucomm"
endif
set file = $$.tmp
(ps $qualif | grep $1) >$file
set nproc = `wc -l $file`
if ($nproc[1] > 1) then
echo "More than one process found : select the one"
echo "you want to terminate and OFF it by number"
echo " "
cat $file
else if ($nproc[1] == 0) then
echo "No process found"
else
set vars = `cat $file`
set pid = $vars[2]
kill -9 $pid
endif
rm -f $file
Received on Thu Mar 28 2002 - 16:07:22 NZST