RE: [SLUG] Select and kill running process

2000-08-22 Thread Jill Rowling

'Course the original kill should've been call sig or something because
that's all it really does - sends signals to processes,
hence
kill -9 123
is really kill -KILL 123
whereas kill -HUP 123
just sends the HUP signal to process 123.

Actually signal 9 seems to be the only common signal number with the
different Unixes.
Better to use the signal name (eg HUP) than the number if you use different
OSs during the day...

Some of the GUI versions of process viewers can be fun, eg sun's sdtprocess
where you can filter things out. I haven't seen a Linux version of something
like this, although top isn't bad.

- Jill
___
Jill Rowling
Snr Design Engineer  Unix System Administrator
Electronic Engineering Department, Aristocrat Technologies Australia
3rd Floor, 77 Dunning Ave Rosebery NSW 2018
Phone:  (02) 9697-4484  Fax:(02) 9663-1412
Email:  [EMAIL PROTECTED]
 
On Tue, Aug 22, 2000 at 10:30:14AM +1000, Umar Goldeli ([EMAIL PROTECTED])
wrote:
 Just don't try it on Solaris. :)
 
 ( yes there is a killall, but it kills.. *ALL* )
 
 $grin$


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-22 Thread Herbert Xu

Jill Rowling [EMAIL PROTECTED] wrote:

 Actually signal 9 seems to be the only common signal number with the
 different Unixes.

You mean there is a Unix out there that doesn't have TERM on 15, or 2 on INT?
-- 
Debian GNU/Linux 2.2 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-22 Thread Andrew Reilly

On Tue, Aug 22, 2000 at 09:44:42PM +, Herbert Xu wrote:
 Jill Rowling [EMAIL PROTECTED] wrote:
 
  Actually signal 9 seems to be the only common signal number with the
  different Unixes.
 
 You mean there is a Unix out there that doesn't have TERM on 15, or 2 on INT?

I was about to post something similar to this last night, but
thought I should look it up first.  I knew that the FreeBSD.org
web pages have links to on-line man pages for a whole host of
versions of Unix, from V7 on.  Lo: just about everyone has
identical SIG numbers to V7, from 1 to 15.  Just as you would
expect.  Things get a little weirder for the extended sigs above
that.  Solaris (SunOS5.7), for example, has 36 fixed-function
signals and an indeterminate (varies at run-time) number of
real-time signals.

Then I looked at the RedHat 6.2 pages.  Whew!  Even some of the
ones below 15 have weird meanings!  All of the signals above 15
have two or three different encodings, depending on what
platform you're using.  That seems weird, but I guess that's a
reflection of compatability with whatever the native version of
Unix is on that platform.  NetBSD is in the same position wrt
multi-platform compatability, and their man pages simply don't
include the signal numbers at all.  They list the names, and
refer to signal.h for the numbers.

At least these ones seem to be universal:

1   HUP (hang up)
2   INT (interrupt)
3   QUIT (quit)
6   ABRT (abort)
9   KILL (non-catchable, non-ignorable kill)
14  ALRM (alarm clock)
15  TERM (software termination signal)

Well, excluding plan-9, which doesn't seem to have the concept
of a numbered signal.

-- 
Andrew


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



[SLUG] Select and kill running process

2000-08-21 Thread Terry Collins

Hello Sluggers

list process | grep desired-process | kill desired-process

Can someone tell me the format of the last part?

ps axf | grep process | kill -9 "process???"

--
   Terry Collins {:-)}}} Ph(02) 4627 2186 Fax(02) 4628 7861  
   email: [EMAIL PROTECTED]  www: http://www.woa.com.au  
   or [EMAIL PROTECTED] 
   WOA Computer Services lan/wan, linux/unix, novell
   snail:  PO Box 1047, Campbelltown, NSW 2560.

 "People without trees are like fish without clean water"


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-21 Thread Ben Leslie

Hi Terry!

On Tue, 22 Aug 2000, Terry Collins wrote:

 Hello Sluggers
 
 list process | grep desired-process | kill desired-process
 
 Can someone tell me the format of the last part?
 
 ps axf | grep process | kill -9 "process???"

ps axf | grep netscape | sed s/^\ *// | cut -f1 -d" " | xargs kill -9

seems to work for me.

kill takes the PID afaik, which is the first argument of ps axf.

The pid is right justified so I strip the spaces off the front, and then use
cut to get the first field (being the PID).

This works, _BUT_ I'm sure there is another (probably better) way of doing
it.

Cheers,

Benno


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-21 Thread Malcolm Tredinnick

On Tue, Aug 22, 2000 at 09:50:25AM +1000, Terry Collins wrote:
 list process | grep desired-process | kill desired-process
 
 Can someone tell me the format of the last part?
 
 ps axf | grep process | kill -9 "process???"

If they are all 5 digit pids, you can use

ps axf | grep process | cut -d' ' -f1 | xargs kill

For 4 digit pids, you need to use -f2 in the cut.

Cheers,
Malcolm

-- 
Malcolm Tredinnickemail: [EMAIL PROTECTED]
CommSecure Pty Ltd

 PGP signature


Re: [SLUG] Select and kill running process

2000-08-21 Thread Stuart Cooper

   Hello Sluggers

   list process | grep desired-process | kill desired-process

   Can someone tell me the format of the last part?

   ps axf | grep process | kill -9 "process???"

Others have presentented you with some clever shell/perl/awk/backtick
ways of doing this. More convenient for me is a command called "killall"
which does this stuff for you; it's part of a package called 'psmisc' on my
system, psmisc also contains the useful fuser and pstree commands.

$ killall netscape-communicator
$ killall -9 netscape-communicator

Hope this helps,
Stuart.



--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-21 Thread Umar Goldeli

Slightly simplified version is:

ps -uaxw|grep process|awk '{print $2}'|xargs kill -9

(adjust $2 with regards to the args on ps)


//umar.

 seems to work for me.
 
 kill takes the PID afaik, which is the first argument of ps axf.
 
 The pid is right justified so I strip the spaces off the front, and then use
 cut to get the first field (being the PID).
 
 This works, _BUT_ I'm sure there is another (probably better) way of doing
 it.
 
 Cheers,
 
 Benno



--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-21 Thread Umar Goldeli

Just don't try it on Solaris. :)

( yes there is a killall, but it kills.. *ALL* )

$grin$


//umar.



 $ killall netscape-communicator
 $ killall -9 netscape-communicator



--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



RE: [SLUG] Select and kill running process

2000-08-21 Thread Aravind Naidu

This command is so dangerous if you work with other OS's... like Unixware,
AIX, Solaris etc

killall does that!! Kills all.


 $ killall netscape-communicator
 $ killall -9 netscape-communicator

 Hope this helps,
 Stuart.



 --
 SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
 More Info: http://slug.org.au/lists/listinfo/slug




--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-21 Thread Stuart Cooper


   This command is so dangerous if you work with other OS's... like Unixware,
   AIX, Solaris etc

   killall does that!! Kills all.

...including the process you wanted to kill in the first place :)

This reminds me of answers to an editor quiz, assume vi without loss of 
generality.

For each question, assume you begin at position 1 of line 1
Q1: How do you delete line 10 of the file?
Answer: dG

Q2: How do you delete line 15 through to line 20 of the file?
Answer: dG

...and so it went on.

From the linux killall manpage KNOWN BUGS section:
   Be  warned  that  typing  killall  name  may  not have the
   desired effect on non-Linux systems, especially when  done
   by a privileged user.
for large values of 'may not'!

The choice of the name 'killall' for the Linux version was unfortunate.
Maybe 'killbyname' would have been better (the original, natural kill could
be aliased to 'killbynature'). I used to carry a shell script
similar to the ps|awkish answers others have posted which I called 'namedkill'
to kill processes by name not by process id.

Stuart.




--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug



Re: [SLUG] Select and kill running process

2000-08-21 Thread Jobst Schmalenbach

On Tue, Aug 22, 2000 at 10:30:14AM +1000, Umar Goldeli ([EMAIL PROTECTED]) wrote:
 Just don't try it on Solaris. :)
 
 ( yes there is a killall, but it kills.. *ALL* )
 
 $grin$


Yep. I remember the first time I used it on a Solaris box ..
You should have seen the SURPRISE ON MY FACE the box (a REAL BIG server!!!) was 
shutting
down and I couldnt do a THING to warn ALL the users on(connected to) that machine .

It does make sense to have "killall squid" or "killall xterm" or something
like that to have ALL processes by THAT name killed. But it does make
sense to have "killall" as well.

What surprised me that there was NO warning aka "Do you really want to do this".
Nope. Nothing. Zilch. Zero. Null. The box just went blank (and so did my face).

It is funny now, but not at that time.
$grin$!



Jobst



-- 
Rule number six: No pooftahs.

|__, Jobst Schmalenbach, [EMAIL PROTECTED], Technical Director|
|  _ _.--'-n_/   Barrett Consulting Group P/L  The Meditation Room P/L  |
|-(_)--(_)=  +61 3 9532 7677, POBox 277, Caulfield South, 3162, Australia|


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug