Grokbase
Topics Posts Groups | in
x
[ help ]

Re: Timeout for a script

View PostFlat  Thread  Threaded | < Prev - Next >
William L. Maltby Re: [CentOS] Timeout for a script
| +1 vote
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
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

_______________________________________________
CentOS mailing list
[email protected: C...@centos.org]
http://lists.centos.org/mailman/listinfo/centos

Thread : Timeout for a script
1)
Jussi Hirvi How could I make a script time out after nn minutes, if it's not finished by then? The practical...
2)
Ian Blackwell I put this little test script together. It seems to work OK... #!/bin/bash timeoutseconds=5 pid=$$...
3)
Jussi Hirvi Ian Blackwell (ian@ikel.id.au) kirjoitteli (12.11.2008 12:13): Hei, Thanks - but I couldn't make...
4)
Filipe Brandenburger Hi, If what you want to kill is the rsync process, do the opposite, run rsync in background, sleep...
5)
Amos Shapira Or maybe the next script that cron executes can kill the previous one as a first step before doing...
6)
James Pearson Try replacing the 'kill -9 $pid' with '/usr/bin/kill -s KILL -$pid' I've used something based on:...
7)
William L. Maltby Do "man bash" and search for "trap". For those not familiar, it can be a little confusing, but it's...
8)
William L. Maltby <*sigh*> Well, it seems that bash doesn't have some of the stuff ISTR from the original *IX stuff...
spacer
View PostFlat  Thread  Threaded | < Prev - Next >
Home > Groups > CentOS > Timeout for a script (8 posts) > View Post