Networker

Re: [Networker] Jukebox Config w/ STK L180

2002-08-22 05:25:14
Subject: Re: [Networker] Jukebox Config w/ STK L180
From: "Russell, Phil (euler:eti)" <Phil.Russell AT EULERGROUP DOT COM>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Thu, 22 Aug 2002 05:27:56 -0400
Script attached. Labels any tapes in the CAP to a pool called 'MAIN Backup'.
Also does various other checks which are explained in the comments.

The script is written for AIX and is actually called from a menu which has
been written for our operators to use and through which they can perform a
large number of networks and library functions.

The majority of the scripts were written by an external consultant from the
company that supports our Networker installation, so I'm afraid I can't
supply them to the list. If you are UK based, I can give you details of the
consultancy/support company..

Phil

######################################################
## Tapes In script for xxxxx                         ##
##                                                   ##
## Written by: ##
## 18/10/01                                          ##
##                                                   ##
## Version 1.00                                      ##
##                                                   ##
#######################################################

#######################################################
##                                                   ##
## Enviroment Variables & Setup                      ##
##                                                   ##
#######################################################
timestamp=`date +%d-%m-%y.%H:%M:%S`
dt=`date`
integer count=0
integer count1=0
integer count2=0
integer empty_count=0
integer filenum=1
integer freeslots=0
integer badtape=0
integer no_caps=0
logpath=/nsr/scripts
lgtpath=/etc/LGTOuscsi
log=/nsr/scripts/tapesin.log
exepath=/usr/bin
jukebox="jb1"
#######################################################
##                                                   ##
## Functions                                         ##
##                                                   ##
#######################################################

#######################################################
##                                                   ##
## funtion: _cleanfile()                             ##
##                                                   ##
#######################################################
_cleanfile()
{
if [ -f $logpath/$filename ];then
rm $logpath/$filename
touch $logpath/$filename
fi
}
#######################################################
##                                                   ##
## funtion: _check_for_stars()                       ##
##                                                   ##
#######################################################
_check_for_stars()
{
$exepath/nsrjb -j $jukebox |grep ": \-\*" | cut -b4-6 > $logpath/$filename
}

#######################################################
##                                                   ##
## Main                                              ##
##                                                   ##
#######################################################

#######################################################
##                                                   ##
##  Clear out old files                              ##
##                                                   ##
#######################################################

filename=emptyslots.tmp
_cleanfile
filename=stars4.tmp
_cleanfile
filename=stars6.tmp
_cleanfile
filename=stars10.tmp
_cleanfile
filename=stars11.tmp
_cleanfile
filename=Tapesin.log
_cleanfile
rm $logpath/init*.tmp >/dev/null 2>/dev/null
# 0. logfile header creation.
echo "Tapesin.log for $(date)" >>$log
# 1. check for empty slots and send results to a file.
echo "Checking for sufficient empty slots."
echo "Checking for sufficient empty slots." >>$log
$exepath/nsrjb -j $jukebox | grep ":    " | cut -b4-6 >
$logpath/emptyslots.tmp
# check for number of tapes loaded in the cap
echo "Checking for number of tapes in the CAPS."
echo "Checking for number of tapes in the CAPS." >>$log
$lgtpath/relem 5.2.0 | grep Import >$logpath/relem.tmp
no_caps=`cat $logpath/relem.tmp | grep Full |wc -l`
echo "There are $no_caps tapes to be labelled."
echo "There are $no_caps tapes to be labelled." >>$log
if [ $no_caps -eq 0 ];then
echo "There are no tapes in the CAP's. Please load some tapes if required
and rerun"
echo "There are no tapes in the CAP's. Please load some tapes if required
and rerun" >>$log
        exit
fi

# 2. Also check to ensure that there are enough slots free

freeslots=`cat $logpath/emptyslots.tmp |wc -l`
if [ freeslots -lt $no_caps ]; then
echo "There are insufficient slots available to import tapes into $jukebox"
echo "Please run the tapesout script and try again"
echo "There are insufficient slots available to import tapes into $jukebox"
>>$log
echo "Please run the tapesout script and try again" >>$log
        exit
fi

# 3. If tape labelling is to be done when no backups are running
# then eject all idle tape drives.

echo "Unloading all idle tape drives."
echo "Unloading all idle tape drives." >>$log
$exepath/nsrjb -u >/dev/null 2>/dev/null

# 4. check to see which slots have :-* and record the slot
# numbers to a file. Then inventory these slots and check
# again for :-*. Report these slots to operators as problem
# tapes.
echo "Performing inventory on slots in an inconsistant state"
echo "Performing inventory on slots in an inconsistant state" >>$log
filename=stars4.tmp
_check_for_stars
for i in `cat $logpath/$filename`
do
$exepath/nsrjb -I -j $jukebox -S$i
done
_check_for_stars


# 5. deposit tapes from CAP into jukebox
echo "Depositing tapes into slots. Please wait"
echo "Depositing tapes into slots. Please wait" >>$log
$exepath/nsrjb -d >/dev/null 2>/dev/null

# 6. funtion: then run nsrjb. grep for all :-* and send this to a file.

filename=stars6.tmp
_check_for_stars


# 7. using wc -l (wordcount) check for number of tapes in LIB :-*. If not
same
# value then using grep -v remove the slot number using the file
# generated earlier for :-*

no_slots=`cat $logpath/$filename |wc -l`
if [ no_slots -ne $no_caps ];then
        for i in `cat $logpath/stars4.tmp`
        do
        cat $logpath/stars6.tmp |grep -v $i > $logpath/stars7.tmp
        cp $logpath/stars7.tmp $logpath/stars6.tmp
        done
fi

# 8. split slots with :-* into 4 separate files
for s in `cat $logpath/stars6.tmp`
do
echo $s >> $logpath/init$filenum.tmp
count=$count+1
        if [ $count = 10 ];then
        count=0
        filenum=$filenum+1
        fi
done

# 9. pass each slot in the file into nsrjb adding each line
# as a -S <slot number> on the same nsrjb command. to label tapes in scratch
# pool. do this for each of the 4 files.
echo "Creating Label command"
echo "Creating Label command" >>$log
filenum=1
for i in `ls $logpath/init*.tmp`
do
echo "$exepath/nsrjb -LY -j $jukebox -b\"MAIN Backup\" \c" >
$logpath/init$filenum.tmp.tmp
for f in `cat $i`
do
echo " -S$f\c" >> $logpath/init$filenum.tmp.tmp
done
mv $logpath/init$filenum.tmp.tmp $logpath/init$filenum.tmp
chmod 555 $logpath/init$filenum.tmp
filenum=$filenum+1
done
echo "Labelling Tapes\c"
echo "Labelling Tapes" >>$log
for i in `ls $logpath/init*.tmp`
do
echo "..\c"
$i
done

# 10. call :-* function again to check for tapes that wont label.
# again removing problem tapes using grep -v to generate a list of tapes
that
# labelled incorrectly then eject these problem tapes to the cap.
# Notify operators of these tapes.
echo "Checking all tapes labelled successfully"
echo "Checking all tapes labelled successfully" >>$log
filename=stars10.tmp
_check_for_stars
#for i in `cat $logpath/stars4.tmp`
#       do
#cat $logpath/stars10.tmp |grep -v $i > $logpath/stars11.tmp
#cp $logpath/stars11.tmp $logpath/stars10.tmp
#done

badtape=`cat $logpath/stars10.tmp | wc -l`

if [ $badtape -ne 0 ]; then
        echo "ejecting problem tapes to CAP"
        echo "ejecting problem tapes to CAP" >>$log
        for i in `cat $logpath/stars10.tmp`
        do
        $exepath/nsrjb -w -S$i >/dev/null 2>/dev/null
        done
        echo "There are $badtape problem tapes in the cap of $jukebox.
Please remove"
        echo "There are $badtape problem tapes in the cap of $jukebox.
Please remove" >>$log
fi


# 12. pass file to nsrjb -o recyclable

echo "\nMarking tapes recyclable\c"
echo "Marking tapes recyclable" >>$log
for i in `cat $logpath/stars6.tmp`
do
echo ".\c"
$exepath/nsrjb -o recyclable -S$i -Y >/dev/null 2>/dev/null
done
echo "\nLabelling complete"
echo "Labelling complete" >>$log



> -----Original Message-----
> From: Rene Rojas [SMTP:rene.rojas AT PINNACOL DOT COM]
> Sent: Tuesday, August 20, 2002 4:53 PM
> To:   NETWORKER AT LISTMAIL.TEMPLE DOT EDU
> Subject:      Re: [Networker] Jukebox Config w/ STK L180
>
> any chance I could see a copy of your script to insert and label the tapes
> into the L180.  do you also have one to eject?
>
> >>> Phil.Russell AT EULERGROUP DOT COM 08/14/02 03:07AM >>>
> When we enter new tapes into our STK L180 we always label them into our
> main
> backup pool. This is done by entering the tapes into the CAP and running a
> script to insert and label them
> .
> We have three other pools, and all pools are marked to allow recycling to
> and from other pools. This way, the largest pool has all the tapes
> initially, but they are available to the other pools as and when required.
> Works fine and does not use auto-media management.
>
> We don't keep cleaning tapes in the library at all. After all, DLT8000's
> hardly ever need cleaning. The operators open up the library once every
> threee months and load the cleaning tapes into all 8 drives manually, run
> them through and them take them out again. Auto cleaning can be more
> trouble
> than it's worth with Networker and tape libraries.
>
> Phil
>
> > -----Original Message-----
> > From: Tim Mooney [SMTP:mooney AT DOGBERT.CC.NDSU.NODAK DOT EDU]
> > Sent: Wednesday, August 14, 2002 12:07 AM
> > To:   NETWORKER AT LISTMAIL.TEMPLE DOT EDU
> > Subject:      Re: [Networker] Jukebox Config w/ STK L180
> >
> > In regard to: RE: [Networker] Jukebox Config w/ STK L180, Faidherbe,...:
> >
> > >Be aware using a lot of pools, you may get serious problems,
> > >Networker not just labelling the tapes he needs but
> > >far more tapes than he needs, causing you problems for
> > >other pools awaiting for a tape.
> >
> > I've seen that exact behavior, and it does indeed tick me off.
> >
> > What I do to avoid the problem is not give NetWorker a mass of blank
> tapes
> > at once.  I keep our jukebox (STK9710) loadport (14 slots) mostly or
> > partially loaded with blank tapes, and then only feed blanks into the
> > jukebox when I know they are going to be needed or when NetWorker
> > indicates that it's "waiting for writeable media".  It is sub-optimal,
> > but I like having more than 1 backup pool, and I'm not about to do
> without
> > auto media management.  It also causes problems for swapping the DLT
> > cleaning cartridge with hardware drive cleaning as run by the jukebox,
> > but I'm also not about to switch to NetWorker-controlled cleanings.
> >
> > Note that this behavior (labelling way more blank tapes into a pool than
> > NetWorker needs) is actually a regression.  NetWorker 4.x never used to
> do
> > that -- it only labelled them as it needed them.
> >
> > Tim
> > --
> > Tim Mooney                              mooney AT dogbert.cc.ndsu.NoDak DOT 
> > edu
>
> > Information Technology Services         (701) 231-1076 (Voice)
> > Room 242-J6, IACC Building              (701) 231-8541 (Fax)
> > North Dakota State University, Fargo, ND 58105-5164
> >
> > --
> > Note: To sign off this list, send a "signoff" 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.
> > =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>
> --
> Note: To sign off this list, send a "signoff" 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.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>
> --
> Note: To sign off this list, send a "signoff" 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.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

--
Note: To sign off this list, send a "signoff" 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>