#!/bin/ksh # # This script is created with aim to ease of monthly archival activity # # VARIABLE DECLARATION # # Note: Please change the ROB and MASTER variable values according to your environment # # ROB is the robotic device path # # MASTER is the robotic control host trap " " 2 13 15 HOST=`hostname` TODAY=`date '+%m%d%Y%H%M'` DAY=`date '+%m%d%Y'` NBBIN="/usr/openv/netbackup/bin" VOLMGR="/usr/openv/volmgr/bin" MASTER="" ROB="" #*************************************************************************************** # This function will check if any tapes are present in tape library I/O slot #*************************************************************************************** checkio() { if echo "s i q" |$VOLMGR/tldtest -r $ROB |grep -i barcode then echo "" echo "" echo "-----------------------------------------------------------------------------------------" echo "Please clear off the following tapes from I/O slot before ejecting the tapes to I/O slot:" echo "-----------------------------------------------------------------------------------------" echo "" echo "s i q" |tldtest -r $ROB |grep -i barcode |awk '{print $3}' |cut -c 1-6 echo "s i q" |tldtest -r $ROB |grep -i barcode |awk '{print $3}' |cut -c 1-6 >> $DATADIR/tapesfoundinioslot.$TODAY else echo "" echo "" echo "---------------------------------------------------------------------------------" echo "There were NO tapes found in I/O slot, Please proceed ejecting the tapes....." echo "---------------------------------------------------------------------------------" fi } #*************************************************************************************** # This function will split an input file by 30 lines per file, because the IBM 3584 tape # library in our setup consists of 30 I/O slots capacity #*************************************************************************************** split() { clear echo "--------------------------------------------------------------------------------------------------" echo "In this option you will enter the file name with full path containing the tape list to be ejected." echo "" echo "Once you enter the file name, the file will be split into 30 lines per file," echo "because the IBM 3584 tapelibrary in our setup consists of 30 I/O slots capacity" echo "--------------------------------------------------------------------------------------------------" echo "" echo "\nEnter the file name with full path: \c" read filename echo "\nChecking...\n" echo "" if [ -f $filename ] then echo "The file "$filename "has "`wc -l $filename |awk '{print $1}'` "lines" echo "" echo "Now going to split..." /usr/bin/split -30 $filename $filename echo "" echo "Split completed and saved under same path you entered" splitname=`echo $filename |awk -F"/" '{print $6}'` spliname1=$splitname"a*" echo $splitname1 echo "" echo "----------------------" echo "Split file names are :" echo "----------------------" ls -rlt $splitname1 else echo "--------------------------------------" echo "The file you entered does not exist..." echo "--------------------------------------" exit $? fi } #*************************************************************************************** # This function will eject the list of tapes 30 at a time #*************************************************************************************** eject() { clear echo "Points to be noted before proceeding further: --------------------------------------------- In this option you will eject the tapes by entering the file name which was split 30 lines each While entering the spilt file enter it one by one with full path All the tapes inside the file (which you are ejecting) should be of same same density, otherwise eject will FAIL ----------------------------------------------------------------- " echo "\nEnter the split file name with full path (which contains <=30 lines):- \c" read splitfile if [ -f $splitfile ] then echo "\nEnter the tape density: \c (hcart - for LTO2, hcart2 - for LTO4, hcart3 - for LTO3" read density echo "\nEnter a 15 character description without space the reason for eject with date :- \c" read reason for i in `cat $splitfile` do $VOLMGR/vmchange -d "${reason}" -m $i $VOLMGR/vmchange -res -m $i -mt $density -rt none -rn 0 -rh $MASTER -v --- -e -sec 1 done else echo "--------------------------------------" echo "The file you entered does not exist..." echo "--------------------------------------" exit $? fi } ##################### # MAIN # # MENU # ##################### clear while true do echo " ------------------ | Bulk tape eject | ------------------ Date:`date '+ %d %B %Y'` | Day:`date '+%A'` | Time:`date '+%T'` MAIN MENU --------- 1) Check the I/O port of the library 2) Split the input file containing list of tapes to be ejected 3) Eject the tapes in bulk Q) Quit Select the above option to proceed further: \c" read choice case "$choice" in 1 )clear checkio echo "\nPress to return to previous menu" read junk clear;; 2 )clear split echo "\nPress to return to previous menu" read junk clear;; 3 )clear eject echo "\nPress to return to previous menu" read junk clear;; [q,Q] )clear #echo "\n\n\n\n\n\t\t\t\tThanks for exclude Admin Menu\n\n\n" #echo "\t\tFinished Date:`date '+ %d %B %Y'` Day:`date '+%A'` Time:`date '+%T'`\n\n\n" exit;; * )clear echo "\n\n\t\tPlease enter value from 1 to 9 or q to quit" echo "\n\nPress to continue.........." read junk clear;; esac done