sleeping for 30 seconds

Richard P. Williamson richard.williamson at u4eatech.com
Fri Mar 26 02:47:01 PST 2004



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  



More information about the freebsd-questions mailing list