On 07/27/2010 02:35 PM, Greg Wooledge wrote: > On Tue, Jul 27, 2010 at 01:44:26PM +0200, Christoph Dittmann wrote: >> What I was going for was a script which executes another command with a >> timeout. > > http://mywiki.wooledge.org/BashFAQ/068 The process I want to put under the timeout does not offer a timeout setting by itself (see below). The bash script http://www.shelldorado.com/scripts/cmds/timeout lets the watchdog stay around long after the command has finished: $ ./timeout -t 60 echo done; sleep 1; ps aux | grep '[s]leep' done 1000 23115 0.0 0.0 9728 828 pts/1 S 15:00 0:00 sleep 60
timeout(1) looks like the way to go. The only thing I don't like is that it is not installed on a standard debian or ubuntu system. That's why I was hoping for a solution in bash. > http://mywiki.wooledge.org/XyProblem Oh, shame on me. :/ I can see how such a script looks like a really bad idea. Just for the background: I run "darcs pull" in a cronjob every few hours to mirror a darcs repository. If the darcs server happens to be offline or not answering properly, it can happen that "darcs pull" hangs for hours without doing anything. This happened only once so far and I couldn't reproduce the circumstances. However, it broke the cronjob because the hanging darcs process kept a lock in the local repository. Just to avoid this I wanted to place a (relatively high) timeout on "darcs pull" so that the repository is not locked indefinitely if something goes wrong. Christoph