backupscript.sh

来自「Solaris环境下Shell编程编程」· Shell 代码 · 共 55 行

SH
55
字号
#!/bin/sh# Purpose - To ensure that the correct options are always used when#           performing a system backup with the ufsdump command.# #           This script takes one argument which is assumed to be a#           filesystem name, it uses the u option to update the #           /etc/dumpdates file, and it asks the user which dump#           level number should be used.## Name: backupscript.sh#if [ $# -ne 1 ]; then   echo "Usage: backupscript filesystem"   exit 1fiif [ -d $1 ]; then   echo "$1 is the filesystem to be backed up."   echo "Select a ufsdump level"   cat << ENDDUMPLEVELS> 0  # which is a full backup> 1> 2> 3> 4> 5> 6> 7> 8> 9ENDDUMPLEVELS    read LEVEL    if [ $LEVEL -ge 0 -a  $LEVEL -le 9 ]; then        echo "Ready to do backup with the following command:"        echo "   ufsdump ${LEVEL}uf /dev/null $1"        echo "Are you ready to do the backup now? [y, n]\c "        read ANSWER        if [ $ANSWER = "y" ]; then            ufsdump ${LEVEL}uf /dev/null $1        else            echo "You did not input a y, try later when you are ready."           exit 3        fi    else         echo "Invalid backup level, exiting..."        exit 2    fielse   echo "Unknown filesystem, exiting..."   exit 4fi

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?