how can I time the execution lenght, and, write out a log at completion like

put the command "date" at the beginning and again at the end of the script.

eg

 echo -n "execution commenced:"
 date 1>&2

 # lots of commands here
 ...

 echo -n "execution completed:"
 date 1>&2


if you want to assign the result of a cmd to a variable put it in back quotes, eg


 start=`date +%Y-%m-%d:%H:%M:S`
 echo $start

I leave you to do the maths to sub start and end times, but to output to a log you just use standard redirection '>' to overwrite and '>>' to append. E.G

echo "$0 executed on $start in $yourmath sec's >>/var/log/mylog.log

HTH

P.

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to