ADSM-L

Display contents of a IBM 7331 8mm library

2002-03-19 23:16:27
Subject: Display contents of a IBM 7331 8mm library
From: Michael Benjamin <MBenjamin AT BUNNINGS.COM DOT AU>
Date: Wed, 20 Mar 2002 12:13:19 +0800
Here's an old script I wrote to view the contents of an IBM 7331 library.

Unfortunately our library offered no barcode reader, so you basically had to
remember where you put your last tape and what was on it. We were not using
it
in conjunction with ADSM/TSM at the time, it was being driven entirely with
tapeutil
and tar in a custom script. (not included)

Also included is the clean_stacker script. They may prove of use or give
some ideas.
For us they're now redundant as we run TSM on that site. Surprisingly, these
scripts
ran for months without incident, the only problem was when the cleaning tape
ran out of
uses, this could be easily included with a CLEANING_COUNTER of some
description.

Use/modify entirely at your own risk. I'm not responsible for any damage you
may cause.

-------------------------8<------"display_stacker"--------8<----------------
----------------
----------------
#!/bin/ksh
#!/bin/ksh

#

# MB - Display contents of stacker in ascii form

#

# 21/06/2001

#

# Notes: No error checking included.

#



SMC="/dev/smc0"                   # SCSI Media Changer

DRIVE23="/dev/rmt1"

DRIVE24="/dev/rmt2"

COUNTER=0

NUMBER_OF_SLOTS=22

SLOT_INFO=""

TEMP_FILE="/tmp/$(basename $0).tmp.$$"

TEMP_FILE2="/tmp/$(basename $0).tmp2.$$"

MEDIA_PRESENT=""

SLOT_STATE=""

NUM_ENTRIES=0

INVAL=""

SLOT_VAL=0

ARG1=$1



touch ${TEMP_FILE}

touch ${TEMP_FILE2}



typeset -L1 slot_address[21]

typeset -L5 slot_layout[21]



clear_array()

{

 while [[ ${COUNTER} -lt ${NUMBER_OF_SLOTS} ]]

 do

    slot_address[${COUNTER}]=0

    slot_layout[${COUNTER}]=0

    (( COUNTER += 1 ))

 done

}



output_state()

{

 COUNTER=0



 # Tapeutil is weird and displays slots backward. This array is used

 # to reverse the slot listing below for output purposes.



 COUNTER=21



 tapeutil -f ${SMC} inventory  | grep -p "Slot Address" | grep "Media
Present" | awk {'print $4'} | \
 while read -r INVAL

 do

   slot_layout[${COUNTER}]=${INVAL}

   (( COUNTER -= 1 ))

 done



 COUNTER=0



 while [[ ${COUNTER} -le 21 ]]

 do

   echo ${slot_layout[${COUNTER}]} >> ${TEMP_FILE2}

   (( COUNTER += 1 ))

 done



 COUNTER=1



 if [[ ${ARG1} = "" ]]

 then

    clear

 elif [[ ${ARG1} = "noclear" ]]

 then

     echo "\c"

 fi





 echo "\n    IBM 7331 STACKER STATUS\n"



 while [[ ${COUNTER} -le ${NUMBER_OF_SLOTS} ]]

 do

   read -r MEDIA_PRESENT



   (( SLOT_VAL = ${NUMBER_OF_SLOTS} - ${COUNTER} + 1 ))



   if [[ $(echo "Slot ${COUNTER} ${MEDIA_PRESENT}" | awk {'print $3'}) =
"Yes" ]]
   then

       echo "\t[=========]\c"

       echo " - ${SLOT_VAL}"

   else

       echo "\t[         ]\c"

       echo " - ${SLOT_VAL}"

   fi



   (( COUNTER += 1 ))

 done < ${TEMP_FILE2}

}



display_drives()

{

 if [[ $(tapeutil -f ${SMC} inventory | grep -p "Drive Address 24" | grep
"Media Present" | awk {'print $4'}) = "Yes" ]]
 then

     echo "\t[=========] - 24 - DRIVE ${DRIVE24}"

 else

     echo "\t[         ] - 24 - DRIVE ${DRIVE24}"

 fi

 if [[ $(tapeutil -f ${SMC} inventory | grep -p "Drive Address 23" | grep
"Media Present" | awk {'print $4'}) = "Yes" ]]
 then

     echo "\t[=========] - 23 - DRIVE ${DRIVE23}"

 else

     echo "\t[         ] - 23 - DRIVE ${DRIVE23}"

 fi

 echo "\n"

}



clear_array

output_state

display_drives



rm -f ${TEMP_FILE}

rm -f ${TEMP_FILE2}



exit 0



-------------------------8<-------"clean_stacker"--------------8<-----------
---------------------
---------------------
#!/bin/ksh
#!/bin/ksh

#

# MB 26/06/2001 - Utility to clean the stacker drives.

#                 Cleaning tape should reside in "bonus slot" 21.

#

#                 Note: Stacker drives must be emptied prior to run!

#                       Gives each drive a generous 120 seconds to

#                       complete a clean.

#



# Set up element addresses for drives.



RMT1="/dev/rmt1"

RMT2="/dev/rmt2"



STACKER_VIEW="/usr/local/scripts/display_stacker"



unload_orphan_tapes()

{

 echo "Auto-unloading currently disabled."

 # Force out any tapes that are lying around in the drives.

 # Essential before clean or backup occurs.



# /usr/bin/tapeutil -f /dev/rmt1 unload > /dev/null 2>&1

# /usr/bin/tapeutil -f /dev/rmt2 unload > /dev/null 2>&1



# /usr/bin/tapeutil -f /dev/smc0 move 23 19 > /dev/null 2>&1

# /usr/bin/tapeutil -f /dev/smc0 move 24 20 > /dev/null 2>&1

}



clean_drives()

{

 ${STACKER_VIEW}

 echo "Moving cleaning tape to rmt1."

 /usr/bin/tapeutil -f /dev/smc0 move 21 23               # Move cleaning
tape to rmt1.
 sleep 5

 #/usr/bin/tapeutil -f ${RMT1} load 2>/dev/null 2>&1

 ${STACKER_VIEW}

 echo "Drive clean in progress drive location 23.. [2 Minutes]"

 sleep 120                                               # Let the clean
occur.
                                                         # Cleaning tape
ejects automagically.
 echo "Moving cleaning cartridge between drives."

 /usr/bin/tapeutil -f /dev/smc0 move 23 24               # Move cleaning
tape rmt1 to rmt2.
 sleep 5

 #/usr/bin/tapeutil -f ${RMT2} load 2>/dev/null 2>&1

 ${STACKER_VIEW}

 echo "Drive clean in progress drive location 24.. [2 Minutes]"

 sleep 120                                               # Let the clean
occur.
                                                         # Cleaning tape
ejects automagically.
 echo "Moving cleaning tape to home position [21]."

 /usr/bin/tapeutil -f /dev/smc0 move 24 21               # Move cleaning
tape home.
 ${STACKER_VIEW}



 echo "\n Cleaning process complete!\n"

}



unload_orphan_tapes

clean_drives



exit 0



-------------------------8<---------------------8<--------------------------
------
------
Mike Benjamin
Mike Benjamin
Systems Administrator
IT&T Systems Department - Store Support
Bunnings Building Supplies,  Perth,  Western Australia.



**************************************************************************
Bunnings Legal Disclaimer:

1)      This document is confidential and may contain legally privileged
        information. If you are not the intended recipient you must not
        read, copy, distribute or act in reliance on it.
        If you have received this document in error, please telephone
        us immediately on (08) 9365-1555.

2)      All e-mails sent to and sent from Bunnings Building Supplies are
        scanned for content. Any material deemed to contain inappropriate
        subject matter will be reported to the e-mail administrator of
        all parties concerned.

**************************************************************************
<Prev in Thread] Current Thread [Next in Thread>
  • Display contents of a IBM 7331 8mm library, Michael Benjamin <=