#!/usr/bin/ksh
ymd=`date +"%y%m%d"`
day=`date +"%w"`
dump_file="/backup/now.dmp"
echo "rename $dump_file to $ymd.dat"
mv /backup/now.dmp /backup/$ymd.dat
if [[ $? != 0 ]]
then
echo "File failed,Please check first."
exit 1
fi
case "$day" in
1 )
echo "Starting mount tape#4096 to driver..."
tapeutil -f /dev/rmt1 mount 4096
if [[ $? = 0 ]]
then
echo "Starting Backup dumpfile to tape..."
pax -x pax -wvf /dev/rmt1 /backup/$ymd.dat
if [[ $? = 0 ]]
then
echo "Backup dump_file to tape has completed."
pax -vf /dev/rmt1
else
echo "Backup dump_file to tape failed,Please check tape."
fi
else
echo "Mount tape failed,please check it."
exit 1
fi
tapeutil -f /dev/rmt1 unmount 4096
echo "Remove dump_file $ymd.dat..."
rm /backup/$ymd.dat
;;
2 )
echo "Starting mount tape#4097 to driver..."
tapeutil -f /dev/rmt1 mount 4097
if [[ $? = 0 ]]
then
echo "Starting Backup dumpfile to tape..."
pax -x pax -wvf /dev/rmt1 /backup/$ymd.dat
if [[ $? = 0 ]]
then
echo "Backup dump_file to tape has completed."
pax -vf /dev/rmt1
else
echo "Backup dump_file to tape failed,Please check tape."
fi
else
echo "Mount tape failed,please check it."
exit 1
fi
tapeutil -f /dev/rmt1 unmount 4097
echo "Remove dump_file $ymd.dat..."
rm /backup/$ymd.dat
;;
3 )
.
.
.
* )
echo "Missioin Failed, Please contact administrator!"
exit 1
esac
阅读(1862) | 评论(1) | 转发(0) |