[ale]Killing all processes on a port

Chris Fowler cfowler at outpostsentinel.com
Thu Nov 29 10:31:54 EST 2001


I looked at the source.  It trates the tty as a file and walsk through /proc
to locate
the correct process.  I wish there was another way.  I'm sure there is and
I'll do a little more
research.

Chris

-----Original Message-----
From: aminus at localhost [mailto:aminus at localhost]On Behalf Of Alan Bowman
To: ale at ale.org
Sent: Wednesday, November 28, 2001 6:33 PM
To: Chris Fowler
Cc: Ale
Subject: Re: [ale]Killing all processes on a port



>>Hello,
>>
>>I want to be able to kill all processes on a tty that I'm not
>>attached to.  I would like to simulate a hangup on that port that
>>would cause getty to respawn and all processes to terminate.

By 'attached to', you mean a tty that you're not currently sitting in
front of?  For that I'd use fuser - for example fuser -k /dev/ttyS01
I have fuser -k /dev/tty  setup as a speed key on my CRT at work, just
for the reason you mention.


>>I would assume this is the best method:
>>
>>1.  Locate tty to kill 2..  Get process id of the main process that
>>uses that as its controlling terminal 3.  Kill it.
>>
>>Is this the best method?  I'm using C to facilate this ability.
 Meaning you want to write some C code that does this, or this is part
of another program?  I don't know C, so I don't know if fuser will work
in that context.  I'll let someone else answer that.

..alan

--
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
                -- Isaac Asimov






---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list