1. Take a backup
2. Erase Tape
3. List content of tape
4. Offline tape
============you can customise this script for adding your own backup folders=========
#!/bin/bash
while :
do
 clear
 echo "   M A I N - M E N U"
 echo "1. Erase Tape"
 echo "2. Rewind Tape"
 echo "3. Full backup"
 echo "4. List next file count content "
 echo "5. Print Tape Status "
 echo "6. Eject Tape  "
 echo "7. Exit Menu "
 echo -n "Please enter option [1 - 7]"
 read opt
 case $opt in
  1) echo "************ Erasing Tape *************";
        sleep 2
     mt -f /dev/rmt/0 erase ;;
  2) echo "*********** Rewinding Tape*************";
        sleep 2
        mt -f /dev/rmt/0 rewind;;
  3) echo "**********Running Full backup**********";
        sleep 2
        echo "Do you want to start the full system backup *ALL DATA IN THE TAPE WILL BE ERASED* [y/n]"
        read ans;
        if [ "$ans" == "y" ]
        then
                mt -f /dev/rmt/0 rewind
                ufsdump -0uf /dev/rmt/n /
                if  [ $? != 0 ] ; then
                MSG="error during ufsdump"
                fi
        ufsdump -0uf /dev/rmt/0n /opt
        ufsdump -0uf /dev/rmt/0n /export
        ufsdump -0uf /dev/rmt/0n /global/.devices/node@1
        ufsdump -0uf /dev/rmt/0n /global/.devices/node@2
        mount |grep /global/backup && ufsdump -0uf /dev/rmt/0n /global/backup #this two lines will check global FS is mounted here or not (imagine it will mount only one place at a time in a cluster env)
        mount |grep /global/oracle && ufsdump -0uf /dev/rmt/0n /global/oracle
        mt -f /dev/rmt/0n rewind
        if  [ $? != 0 ] ;
        then
   echo "Unable to rewind the tape after finishing the backup"
        fi
        fi
        ;;
  4) echo "Skipping to next file count ";
        sleep 2
        ufsrestore tvf /dev/rmt/0n|more ;;
 5) echo "Checking for tape status ";
        sleep 2
        mt -f /dev/rmt/0 status ;;
        6) echo "Ejecting Tape ";
        sleep 2
        mt -f /dev/rmt/0 offline ;;
        7) echo "Thanks for using, Have a nice day";
        sleep 2
        exit;;
  *) echo "$opt is an invaild option. Please select option between 1-4 only";
     echo "Press [enter] key to continue. . .";
     read enterKey;;
esac
done
 
 
No comments:
Post a Comment