Subject: Re: kill(1) a pid after timeout
To: None <>
From: None <>
List: tech-userlevel
Date: 07/24/2007 16:54:19
On Tue, Jul 24, 2007 at 10:47:46AM -0700, Jan Schaumann wrote:
> Hi,
> I occasionally have the need to kill a process iff it has been running
> for longer than N seconds.  Instead of parsing the output of ps(1) and
> then calling kill(1) myself, I have attached a patch to add the "-t
> timeout" flag to kill(1).
> Does that seem useful to others as well?

I don't personally have any use for that flag, but I can see how it'd
be useful... however, I don't like the terminology--it's not a timeout,
is it? To me, "timeout" implies doing something, then waiting for an
event to happen within a certain amount of time, then doing something
else if the event hasn't happened in that time. I guess you're looking
at it in terms of "start process, wait for it to exit within a certain
amount of time, then kill it if it hasn't exited", but the first two
parts are outside the scope of kill(1); kill(1) isn't waiting for the
timeout. If I didn't read the manpage (bad idea, I know :), I'd think
that kill -t means "send the signal to the process, and if it hasn't
exited within the timeout period, send it a KILL signal".

That said, I don't have any good suggestions on what to name the
flag. Perhaps "age"?
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 31 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++