Networker

[Networker] sched_label.sh (cron based auto labeler)

2003-11-20 16:21:12
Subject: [Networker] sched_label.sh (cron based auto labeler)
From: "Reed, Ted G II [ITS]" <ted.reed AT MAIL.SPRINT DOT COM>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Thu, 20 Nov 2003 15:20:44 -0600
#!/bin/ksh
#
# Name: sched_label.sh
#
# Location: /usr/local/Legato/bin
#
# Purpose: To automate the amount of tapes available in the jukeboxes
#
#*******************
# Script Variables *
#*******************

MMINFO="`which mminfo` -s mastername"
NSRJB="`which nsrjb` -s mastername -j mastername_01"
SERV=`uname -n`
NSRMM="`which nsrmm` -s mastername"
#MONTHTAPES=5
#MONTHTAPES=15
BRPOOLTAPES=3
#BRPOOLTAPES=9
#CLONEKSTAPES=3
CLONEKSTAPES=9
ARCHONETAPES=5
ARCHTWOTAPES=5
ARCHFIVETAPES=5
ARCHSEVENTAPES=5
ARCHCLONETAPES=5
LOCATION=`uname -n`

#***************
# Main Program *
#***************

# This section deletes all recyclable tapes in the library

#for I in $($NSRJB | grep yes | cut -f2 -d: | cut -f2 -d" " | cut -c1-6)
#do $NSRMM -y -d $I
#done

# This section determines the amount of tapes for each pool currently in
the library

$MMINFO -av -r 'volume,pool,location' -q "%used=0" | grep $LOCATION >
/tmp/$SERV
EMPTYMNTH=`grep "One Month" /tmp/$SERV | wc -l`
EMPTYBRPOOL=`grep "BR Pool" /tmp/$SERV | wc -l`
EMPTYCLONEKS=`grep "Clone Vault KS" /tmp/$SERV | wc -l`
EMPTYARCHONE=`grep "Archive One" /tmp/$SERV | wc -l`
EMPTYARCHTWO=`grep "Archive Two" /tmp/$SERV | wc -l`
EMPTYARCHFIVE=`grep "Archive Five" /tmp/$SERV | wc -l`
EMPTYARCHSEVEN=`grep "Archive Seven" /tmp/$SERV | wc -l`
EMPTYARCHCLONE=`grep "Archive Clone" /tmp/$SERV | wc -l`

# This section inventories the unknown tapes in the library

for I in $($NSRJB | grep "*" | grep -v M | grep -v "not registered" |
cut -f1 -d:)
do $NSRJB -I -S $I
done

# This section labels the needed amount of tapes for the night's backups

(( NUM_TO_LABEL = $MONTHTAPES-$EMPTYMNTH ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "One Month" -S $I > /dev/null 2>&1
  done
fi

(( NUM_TO_LABEL = $BRPOOLTAPES-$EMPTYBRPOOL ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "BR Pool" -S $I > /dev/null 2>&1
  done
fi

(( NUM_TO_LABEL = $CLONEKSTAPES-$EMPTYCLONEKS ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "Clone Vault KS" -S $I > /dev/null 2>&1
  done
fi

(( NUM_TO_LABEL = $ARCHONETAPES-$EMPTYARCHONE ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "Archive One" -S $I > /dev/null 2>&1
  done
fi

(( NUM_TO_LABEL = $ARCHTWOTAPES-$EMPTYARCHTWO ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "Archive Two" -S $I > /dev/null 2>&1
  done
fi

(( NUM_TO_LABEL = $ARCHFIVETAPES-$EMPTYARCHFIVE ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "Archive Five" -S $I > /dev/null 2>&1
  done
fi

(( NUM_TO_LABEL = $ARCHSEVENTAPES-$EMPTYARCHSEVEN ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "Archive Seven" -S $I > /dev/null 2>&1
  done
fi

(( NUM_TO_LABEL = $ARCHCLONETAPES-$EMPTYARCHCLONE ))
if [ $NUM_TO_LABEL -gt 0 ]
then 
  for I in $($NSRJB | grep yes | grep -v not | head -$NUM_TO_LABEL | cut
-f1 -d:)
  do
    $NSRJB -L -Y -b "Archive Clone" -S $I > /dev/null 2>&1
  done
fi

--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

<Prev in Thread] Current Thread [Next in Thread>
  • [Networker] sched_label.sh (cron based auto labeler), Reed, Ted G II [ITS] <=