[ILUG] Terminate process after a set time limit

Pádraig Brady P at draigBrady.com
Fri Nov 3 10:52:43 GMT 2006


Pádraig Brady wrote:
> Kieran Tully wrote:
> 
>>Is there a standard way to impose a time limit on a child process, and
>>terminate it when the limit is reached?
> 
> I guess you could do it with trap?
> 
> #!/bin/sh
> trap exit 17
> sleep 900&
> potentially_long_command

Did this on the train this morning:
http://www.pixelbeat.org/scripts/timeout

Pádraig.



More information about the ILUG mailing list