See http://www.ruby-doc.org/core-1.9/classes/Process.html#M003012

It and sleep have all the tools you need to do this. The idea is that 
you have a master process that forks the child process which runs the 
script you want to time.  The master process then loops. The loop
sleeps a bit then calls waitpid with the WNOHANG flag to see if the 
child has exited.  Count the sleep time, or use Time to figure out how 
long you've been waiting.. Once you've waited long enough, use kill
to kill the child process.  If the child has exited.. the master 
process exits.

The length of your sleep in the loop of the master process determines
- The precision with which you measure the timeout.
- The latency with which the master process responds to normal child exit.

Ron.

Aldric Giacomoni wrote:
> Any idea how to do that?
> Say, I don't want a program to run longer than 5 hours.. How would that 
> be implemented?
> 
> --Aldric


-- 
Ron Fox
NSCL
Michigan State University
East Lansing, MI 48824-1321