#!/usr/bin/ksh
sleep 10
HOST=`/usr/bin/uname -n | /usr/bin/tr '[a-z]' '[A-Z]'`
LOG=`/usr/bin/find / -name dsmsched.log -mtime 0 -print 2>/dev/null`
/usr/bin/grep Scheduled $LOG | /usr/bin/tail -1 > /tmp/tsmreport.log
/usr/bin/grep "completed successfully" /tmp/tsmreport.log > /dev/null 2>&1
comp_sts=$?
if [ $comp_sts = 0 ]
   then subj="$HOST TSM Backup Completed Successfully"
   else subj="<<< $HOST TSM Backup FAILED!!! >>>"
fi
/usr/bin/cat /tmp/tsmreport.log | /usr/bin/mailx -m -s "$subj" $MAILLIST
/usr/bin/rm /tmp/tsmreport.log
exit 0
