[CentOS] Timeout for a script

William L. Maltby CentOS4Bill at triad.rr.com
Wed Nov 12 10:37:49 UTC 2008


On Wed, 2008-11-12 at 11:54 +0200, Jussi Hirvi wrote:
> How could I make a script time out after nn minutes, if it's not finished by
> then?
> 
> The practical context: I have a dozen or so of backup scripts in a directory
> "daily", and they are run by cron like this:
> > 0 23 * * 1-6 run-parts /root/daily
> 
> Sometimes one of the scripts hang, in which case the rest of the scripts are
> delayed more than can be allowed.

Do "man bash" and search for "trap". For those not familiar, it can be a
little confusing, but it's well worth the effort, in terms of results
and learning.

> 
> - Jussi
> <snip sig stuff>

HTH
-- 
Bill



More information about the CentOS mailing list