Quote:> I'd like to add the logic in my backup script of exactly how long it took.
> I've got a start time and an end time, how can I subtract or possibly start
> a counter? Also, I have to account for an ending time in a different day as
> I start some backups around 10pm.
Add something like this to the start of your script:
ts_start=`perl -e 'print time, "\n";'`
and something like this at the end:
perl -e 'print "elapsed time: ", time - $ARGV, " seconds\n";' $ts_start
Of course, if you want a better value than just raw number of seconds,
you can add appropriate code.
Something like this might look good:
perl -e '($sec,$min,$hour) = gmtime(time - $ARGV);
printf "elapsed time: %02d:%02d:%02d\n", $hour, $min, $sec;
(Note that this example breaks if more than 24 hours have elapsed, you
can mod off the seconds in the current day and div off the number of
days if you need to.)
You *do* have perl, don't you? If you don't, get it. Learn to use it.
Jan L. Peterson PartNET tel. +1 801 581 1118
Senior Systems Admin 423 Wakara Way, Suite 216 fax +1 801 581 1785