Backup Script using fbackup command Help Needed.

Hi Friends,

I'm new to unix, I have the below script which takes regular backup. Now if fbackup fails I get the below messages in my log as
fbackup(3047): could not open output file /dev/rmt/0m
fbackup(3019): would you like to enter a new output file?
fbackup(3004): writer aborting
fbackup(1002): Backup did not complete : Reader or Writer process exit
Backup ENDED @ Thu Feb 19 17:02:47 CST 2009

Now alogwith these messages in the log, I also want a message to be thrown in the cosnole of the root user, incase the fbackup fails. Please help me to modify the script.

Its a bit urgent, please friends help.

#! /bin/ksh
myname=$(whoami)
if ([ $myname = root ])
then
echo 'BE SURE TO SHUTDOWN MONITROL APPLICATION'
# echo 'unmounting cdrom'
# echo 'Doing the backup'
echo 'Backup STARTED @ ' `date`
/bin/nice /etc/fbackup -f /dev/rmt/0m -i / -I /opt/monitrol/tmp/Index.full
echo 'Backup ENDED @ ' `date`
rcp -p -r /opt/monitrol/tmp/Index.full root@pmsmtv:/opt/Index.mix
# echo 'mounting cdrom'
# echo 'Done with the backup - '
else
echo '*** You MUST be ROOT to do a backup ***'
echo ' (because you need permission to read ALL files)'
echo ' '
echo ' '
fi

Thanks,

Avik.

The simplest way is to grep for any error message in the log file and print the message accordingly. Pls let me if you need the syntax.

/bin/nice /etc/fbackup -f /dev/rmt/0m -i / -I /opt/monitrol/tmp/Index.full
if [[ $? != "0" ]]
then
echo "Tape errorrrrrrrrr!!"
echo 'Backup ENDED @ ' `date`
exit 0
fi
echo 'Backup ENDED @ ' `date`

Thanks for your reply. But I'm actually looking how to redirect the fbackup steps into a sperate file.

Thread closed!
Continue here : fbackup problem
And please follow the rules