Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Mar 2004 14:18:38 +0000
From:      "Richard P. Williamson" <richard.williamson@u4eatech.com>
To:        Jan Grant <Jan.Grant@bristol.ac.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: sleeping for 30 seconds
Message-ID:  <6.0.3.0.2.20040326140911.025b5cc0@cygnus>
In-Reply-To: <Pine.GSO.4.58.0403261305560.20466@mail.ilrt.bris.ac.uk>
References:  <6.0.3.0.2.20040326103618.025871c0@cygnus> <Pine.GSO.4.58.0403261305560.20466@mail.ilrt.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
At 13:08 26/03/2004, Jan Grant wrote:
>On Fri, 26 Mar 2004, Richard P. Williamson wrote:
>
>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.

Except it doesn't tell me how long it ran for before it falling
over, which is the bit I need to look at.

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

That's what I'm looking for, thanks!

(that, and )

if [ $time_taken -lt 10 ]; then
  sleep 50
fi

Regards, and thanks!
rip 



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