[ale]Killing all processes on a port

Alan Bowman aminus at mindspring.com
Wed Nov 28 18:32:56 EST 2001



>>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