Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Mar 2004 10:50:06 +0000
From:      "Richard P. Williamson" <richard.williamson@u4eatech.com>
To:        freebsd-questions@freebsd.org
Subject:   sleeping for 30 seconds
Message-ID:  <6.0.3.0.2.20040326103618.025871c0@cygnus>

next in thread | raw e-mail | index | archive | help


Hello world,

I've got a shell script that in essence does this:

FOREVER:
  pre-process stuff
  mainapp
  post-process stuff

If the mainapp returns too soon, the assumption must be that 
there is a configuration problem of some sort.  Under those
conditions, I don't want to immediately jump to the pre-process
stuff and start the mainapp again.

Instead, I want to sleep for an arbitrary time between attempts
(giving an operator some leeway to fix the configuration before
trying again).

If mainapp runs long enough, then it should just post-, pre-
mainapp again immediately.

What's a good sh algorithm for the above?  (assume < 10
seconds indicates error condition and a 50 second sleep
between iterations when necessary, and I don't need a
'five attempts then sleep' thing).  Also, assume I've
simplified for the home audience.  The sh script is 
lots more involved then the example above implies. 

rip  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6.0.3.0.2.20040326103618.025871c0>