Monday, July 19, 2010

Script to re-using tapes from other systems or older Netbackups

Re-using tapes from other systems or older Netbackups,Expire the tape using shell script.

Run the following script:

root@servlet# ./manual_expired_tape.ksh expired_tape_list.cfg

Output:

Mon Jul 19 12:18:02 ICT 2010
1) expiring PU302 ...
2) expiring PL319 ...
3) expiring PL313 ...
4) expiring PL315 ...
5) expiring PL324 ...
6) expiring PQ323 ...
7) expiring PM328 ...
Mon Jul 19 12:18:02 ICT 2010
Done.
_______________________________________
Coding

File Name: manual_expired_tape.ksh

#!/usr/bin/ksh
#Create Date: 2010-07-19
# Re-using Tapes from other systems or older Netbackups
#Usage: ./manual_expired_tape.ksh
# ./manual_expired_tape.ksh expired_tape_list.cfg
#-Check Param
if [ $# -eq 0 ]
then
#TAPE_LABEL_LIST=expired_tape_list.cfg
echo "\n Usage: ./manual_expired_tape.ksh "
echo " ./manual_expired_tape.ksh expired_tape_list.cfg\n"
echo "Exit!"
exit 1
else
TAPE_LABEL_LIST=$1
fi
#-Check file exist!
date
if [ -f $TAPE_LABEL_LIST ] && [ -s $TAPE_LABEL_LIST ]
then
TAPELABEL=`cat ${TAPE_LABEL_LIST}` # Initialise a tape label.
count=0 # Initialise a counter
for tapeid in ${TAPELABEL} # Set up a loop control
do # Begin the loop
count=`expr $count + 1` # Increment the counter
echo "$count) expiring $tapeid ..." # Display the result
#Moving tapes to the scratch pool
echo "/usr/openv/netbackup/bin/admincmd/bpexpdate -m $tapeid -d 0 -force"
done # End of loop
date
echo "Done."
else
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "$TAPE_LABEL_LIST : File does not exist or File is empty."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
fi


#############################################
Config File Name: expired_tape_list.cfg


PU302
PL319
PL313
PL315
PL324
PQ323
PM328

#######################################

Edit Tape label in config file and run script.

No comments: