Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8238560
  • 博文数量: 444
  • 博客积分: 10593
  • 博客等级: 上将
  • 技术积分: 3852
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-09 15:26
文章分类

全部博文(444)

文章存档

2014年(1)

2013年(10)

2012年(18)

2011年(35)

2010年(125)

2009年(108)

2008年(52)

2007年(72)

2006年(23)

分类:

2011-07-22 11:07:37

#!/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
阅读(2079) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~