[CentOS] Re: command to ensure other command does last longer than5 seconds

Sat Apr 7 18:08:35 UTC 2007
William L. Maltby <CentOS4Bill at triad.rr.com>

On Sat, 2007-04-07 at 14:03 -0400, William L. Maltby wrote:
> On Sat, 2007-04-07 at 14:20 -0300, Rodrigo Barbosa wrote:
> <snip>

> > 
> > If I've got your meaning write, you are proposing something like:
> > 
> > ( sleep $TIMER; kill -WHATEVER $PID )&
> > 
> > Which is pretty interesting way to do it, which I haven't though about
> > until now. I never tried (...)&, and after you said this, I decided to
> > see if it worked. And it did. It is a pretty neat way to create
> > alarms inside a shell script.

Almost forgot - you might enjoy looking at the "trap" command in bash
(and other shells). Allows entry to arbitrary routines based on
asynchronous events, similar to signal handling in "C". Receiving
function has the choice of resetting the trap, issuing arbitrary actions
and signals, setting other traps, etc. Fun stuff.

> <snip>

--
Bill