tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Woods Marc A Contr WRALC/LNXA <Marc.Woods () robins ! af ! mil>
To: tru64-unix-managers
Subject: Summary scripting help
Date: Thu, 28 Mar 2002 16:07:01 +0000	[thread overview]
Message-ID: <102653731622917.tru64-unix-managers.marc@archive.invalid> (raw)

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


                 reply	other threads:[~2002-03-28 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox