sleeping for 30 seconds

Jan Grant Jan.Grant at bristol.ac.uk
Fri Mar 26 05:10:47 PST 2004


On Fri, 26 Mar 2004, Richard P. Williamson wrote:

> 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.

You might, if the possibility is there, want to use the exit value of
the main process to indicate errors, which is perhaps a little more
reliable.

If you want the time in seconds between two points, you might try
something like this:

	start_time=`date +%s`
	# ... do something
	end_time=`date +%s`
	time_taken=$(($end_time - $start_time))



-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287088 Fax +44 (0)117 9287112 http://ioctl.org/jan/
New Freedom of Information Act: theirs, to yours. Happy now?


More information about the freebsd-questions mailing list