send mail after script finishes running

Hi All,

We now have a Log file which has time stamps of all the scripts ran. It has start
time and end time. I now have a requirement to send mail to the Admin after the script finishes running.

Can some one help me with a Script which will send mail with Start time and
End time of the script by picking the lines from the below sample log or in any other way which i can tell my script to mail start and end time after it finish running?

swift.log

SWIFT Europe Update Starting for: 04/23/07 21:05:44
SWIFT Europe Update Ending for: 04/23/07 21:08:01
Swift NA Begining : 04/24/07 00:28:22
Swift NA Ending : 04/24/07 00:28:29
Swift AUS Begining : 04/24/07 00:59:17
Swift AUS Ending : 04/24/07 00:59:25

Thanks
Srikanth GR

Since one script is working on Europe, NA, and AUS, simply create two variables -
one at the start of the process, one at the end
start=$(date)
....
ending=$(date)
Don't use the log file content, unless you want to resort to date processing using perl, ruby or python.

echo "Start= $start End=$end" | \
mailx -s 'job completion times' admin@someplace.com

or use a log parser, this may work if changing the logging statements in your scripts isn't possible.