I made a following script for Data Backup on Tape Device, but script is not working fine. Please review the script
#################################
DAT=`date +%d_%m_%Y`
BDIR="/home/userid/$DAT"
TD="/dev/st0"
LOGS="/scripts/$DAT"
clear
echo | tee $LOGS
if mt -f $TD status | grep 41010000 > /dev/null
then
echo "Tape Found in DRIVE" | tee -a $LOGS
mt -f $TD load
if test $? = 0
then
echo "Tape loaded successfully"
echo | tee -a $LOGS
SIZE=`du -sh $BDIR | cut -f1`
echo "Size of $DAT Directory: $SIZE" | tee -a $LOGS
echo | tee -a $LOGS
time_start=`date +%s`
echo "BACKUP START at" `date` | tee -a $LOGS
echo
tar -cvp -f $TD $BDIR | tee -a $LOGS
mt -f $TD offline
if test $? = 0
then
echo "Tape unloaded sucessfully"
else
echo "Unloading Tape failed. Check it manually"
fi
echo
fi
else
echo " Cartridge not found in DRIVE1"
echo " Please Insert Cartridge in DRIVE1 Only"
sleep 6
exit 2
fi
echo | tee -a $LOGS
time_end=`date +%s`
time_elapsed=$((time_end - time_start))
echo "BACKUP FINISHED at" `date` | tee -a $LOGS
echo | tee -a $LOGS
echo "Backup Completed Time $(( time_elapsed / 60 )) Minute $(( time_elapsed % 60 )) Seconds" | tee -a $LOGS
echo | tee -a $LOGS
echo
read -p "Press Enter to continue.........." readDamKey
exit 0
#################################
I m using Oracle Enterprise Linux with BASH Shell
Error in Backup Script
are we supposed to guess the error?
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
-
- Subedar
- Posts: 355
- Joined: Sat May 07, 2005 11:54 am
- Location: Lahore
- Contact:
post the error you are getting.
Regards
Rana Tanveer
+923224194457
Linux Student
For Affordable Web Development http://www.affordableprogrammers.com
http://www.qualityprogrammers.com
Rana Tanveer
+923224194457
Linux Student
For Affordable Web Development http://www.affordableprogrammers.com
http://www.qualityprogrammers.com