Date: Fri, 26 Mar 2004 13:08:54 +0000 (GMT) From: Jan Grant <Jan.Grant@bristol.ac.uk> To: "Richard P. Williamson" <richard.williamson@u4eatech.com> Cc: freebsd-questions@freebsd.org Subject: Re: sleeping for 30 seconds Message-ID: <Pine.GSO.4.58.0403261305560.20466@mail.ilrt.bris.ac.uk> In-Reply-To: <6.0.3.0.2.20040326103618.025871c0@cygnus> References: <6.0.3.0.2.20040326103618.025871c0@cygnus>
next in thread | previous in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.58.0403261305560.20466>