Forum Discussion

Justin_Brooks's avatar
12 years ago

Auto-Eject tapes that arent expired Media

Without using a 3rd party tool (or perhaps with), is there a way, where as soon as I place tapes in the library, and run an Inventory, that NetBackup will read the tapes, and anything that is NOT expired/scratch, automatically export to the MAP(media access portal)

 

Example:

 

I load 30 tapes into the library,

27 have expired rentention , and are scratch

3 were written to last week, and have 28 days to go.

Netbackup does inventory of Robot, and then kicks back out the 3 tapes to the MAP

 

Thanks!

  • OK, this is a very basic way of doing it :

    NOTE:

    This assumes you have one robot (at the moment, set for TLD type and robot 0)

    If there are multiple robots it gets a bit harder and you have to capture the robot number for each media and then work out the robot control host - that is quite a bit of work, or at least I think it is.

    I wrote it on Solaris using ksh - Linux may require a bit of alterantion, not sure as I have no Linux box right at this second.

    #!/usr/bin/ksh
     
    >/tmp/robotic_media.txt
    >/tmp/eject_medialist.txt
     
    ROBOT_NUM=0
    ROBOT_TYPE=tld
     
    vmquery -a |grep "media ID" |awk -F: '{print $2}' |sed "s/^[ \t]*//" |while read MEDIAID
      do
         if [[ $(echo $(vmquery -m $MEDIAID |grep -i  "Robot Type" |awk -F: '{print $2}' |sed "s/^[ \t]*//")) != "NONE - Not Robotic (0)" ]]
           then
             echo $MEDIAID >>/tmp/robotic_media.txt
         fi
      done
     
    cat /tmp/robotic_media.txt |while read ROB_MEDIAID
      do
       if [[ $(echo $(vmquery -m $ROB_MEDIAID |grep -i  "Assigned" |awk -F: '{print $2}' |sed "s/^[ \t]*//")) = "---" ]]
         then
         echo $ROB_MEDIAID >>/tmp/eject_medialist.txt
       fi
     done
     
    LISTMEDIA=""
    cat /tmp/eject_medialist.txt |while read i
      do
        LISTMEDIA=$LISTMEDIA:$i
      done
    echo "vmchange -res -multi_eject -verbose -rn $ROBOT_NUM -rt $ROBOT_TYPE -single_cycle -w -ml $(echo $LISTMEDIA |sed 's/^://')"
     
     
    Martin