Here's some code to start you.
Code:
#backup
RSERR=/home/logs/rserr.log
SUCCESSLOG="/home/logs/rs_success"
BSERVER="backupserver"
export RSERR BSTATUS SUCCESSLOG BSERVER
ping -q -c1 $BSERVER >/dev/null || exit
>$RSERR
echo " " >>$SUCCESSLOG
echo "rsync to $BSERVER" >$SUCCESSLOG
echo "Started `date`" >>$SUCCESSLOG
echo " " >>$SUCCESSLOG
rsync --recursive -azv /blah/blah/ "$BSERVER":/blah/blah 2>>$RSERR >>$SUCCESSLOG
if [ -s $RSERR ]
then
mailpager.pl "myself@example.com" $RSERR "Rsync Report"
mailpager.pl "someoneelse@example.com" $RSERR "Rsync Report"
exit
fi
echo "Finished ok `date`" >>$SUCCESSLOG
mailpager.pl "myself@example.com" $SUCCESSLOG "Rsync Report $BSERVER"
mailpager.pl "someoneesle@example.com" $SUCCESSLOG "Rsync Report $BSERVER"
I use a Perl script to send mail out authenticated since I'm sending from a NATted private IP. You'll probably want to use the Net::SMTP; in Perl to accomplish the same if you are behind a firewall.
Perl has all kinds of good tools to convert localtime. Really, you/I might consider rewriting the whole script in Perl. Just download the Perldocs to a local file, point your browser to it, and stay camped out in the Overview section for a while...
Have fun!