#!/bin/sh # # do_offsite # # # ADSM Offsite processing script # # ORIG Mark Simonds 9/23/1998 # # uses adsm drm commands to determine volumes to move offsite # uses eject_vol (dtelm) commands to do bulk ejects # set variables PATH=$PATH:/usr/lpp/adsm/bin:/usr/lpp/dtelm/bin d=`date +%m-%d-%y_%H:%M` dir=/usr/lpp/adsmserv/offsitelogs mkdir -p $dir eject_list=$dir/ejected.${d} missing_list=$dir/missing_list.${d} capsize=14 # cap door slot quantity usr=ms pw=ms # ------------------------------------------------ # adsm command procedure, issues ADSM administrative commands adsmcmd () { DSM_CONFIG=/usr/adsm/dsm.opt.D export DSM_CONFIG dsmadmc -id=$usr -pa=$pw $* } # ------------------------------------------------ # procedure to build eject list file build_ejects () { clear echo " - BUILD EJECTION LIST -" echo " Please wait while the tape eject list is built...\c" # get list of ADSM volumes to take offsite # puts the volumes in $eject_list adsmcmd q drmedia wherestate=mountable f=cmd cmdfile=$eject_list cmd=\&VOL 2>/dev/null 1>/dev/null echo "..done" } # ------------------------------------------------ # passes $eject_list to dtelm eject_vol command # requires ACS/LS do_ejects () { volnum=`cat $eject_list | wc -l | awk '{print $1}'` sleep 1 echo "" echo " - EJECT TAPES -" echo " Beginning tape ejection through the CAP door." echo " - $volnum tapes are scheduled for ejection." echo " - $capsize slots are available in the CAP." echo " - The CAP may be filled several times." echo " Remove the tapes as they are ejected and close the CAP." echo "" echo " Wait until the contol panel says:" echo " \"press execute to unlock CAP\"" echo " or some tapes may not be ejected" echo "" echo " Press return to continue \c" read null # pass list file to dteml for ejection eject_vol -c '0,0,0' -l $eject_list -d $capsize sleep 2 } # ------------------------------------------------ # called to show volume ejection list show_list () { COUNT=0 for e in `cat $eject_list` ; do if [ $COUNT -lt 7 ] ; then echo "$e \c" COUNT=`expr $COUNT + 1` else echo "$e" COUNT=0 fi done echo "" } # end of show_list procedure # ------------------------------------------------ # procedure to verify that ejected tapes are correct # if not, runs "process_wrong" and "process_missing" procedures # to handle the exceptions verify_ejects () { echo "" echo " - TAPE VERIFICATION -" echo " The system belives it ejected the following $volnum tapes:" # loop to make volumes appear 4 to a line echo "" loop=y show_list while [ $loop = y ] ; do echo "" echo " Did you receive exactly these volumes?" echo " Please enter \"y\" for yes and \"n\" for no \c" read ok case $ok in n ) do_err=y ; loop=n ;; y ) do_err=n ; loop=n ;; l ) show_list ;; * ) ;; esac done } # ------------------------------------------------ # procedure to process wrong tape volumes that were ejected # this implies that an ACS/LS audit is needed, not that ADSM is hosed process_wrong () { echo "" echo " - WRONG VOLUMES EJECTED -" loop=y while [ $loop = y ] ; do echo "" echo " If any wrong volumes were ejected, enter them now" echo " separated by spaces. If not, press return." echo " example: 000200 000340 000420" echo "" echo "wrong volumes received: \c" read wrong_vol echo " If this is correct, type \"y\", if not, press return" read correct case $correct in y ) loop=n ;; * ) loop=y ;; esac done # echo "$wrong_vol" } # end of process_wrong procedure # ------------------------------------------------ # procedure to process missing tapes ejected # several factors, tape mounted and can't be ejected for one process_missing () { echo "" echo " - MISSING VOLUMES -" loop=y while [ $loop = y ] ; do echo "" echo " If any volumes were missing, enter them now" echo " separated by spaces. If not, press return." echo " example: 000200 000340 000420" echo "" echo "mssing volumes not received: \c" read missing_vol echo " If this is correct, type \"y\", if not, press return" read correct case $correct in y ) loop=n ;; * ) loop=y ;; esac done # echo "$missing_vol" } # end of process_missing procedure # ------------------------------------------------ # procedure to volume set status and location in ADSM # uses "move drmedia" to set state and location fields # uses update volume for missing volumes set_locations () { echo "" echo " - UPDATING TAPE LOCATIONS -" echo " Setting the tapes Disaster Recovery State to: VAULT" echo " Setting the tapes location to: \"offsited:$d\"" echo " Setting the tapes access to unavailable" eject_list=`cat $eject_list` # set tape locations for e in $eject_list ; do adsmcmd move drmedia $e tostate=vault tolocation="offsited:$d" remove=no 1>/dev/null 2>/dev/null done missing_vol="000566 000559" # set missing tapes to locations back in ADSM if [ "$missing_vol" != "" ] ; then for e in $missing_vol ; do adsmcmd update volume $e access=readw location="''" 2>/dev/null >/dev/null done fi } # run the procedures build_ejects do_ejects verify_ejects if [ $do_err = y ] ; then process_wrong process_missing fi set_locations echo "" echo " press return to continue \c" read null exit 0 ------ =_NextPart_000_01BE1E49.817897C4-- =======================================================================