Networker

Re: [Networker] Tape Sorting Routine

2006-04-29 05:22:38
Subject: Re: [Networker] Tape Sorting Routine
From: Davina Treiber <DavinaTreiber AT PEEVRO.CO DOT UK>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Sat, 29 Apr 2006 10:18:34 +0100
King, David - Eastman said...:

What with us replacing many tapes that have gone bad with new ones, our
barcodes are out of order.

Has anyone written a routine to resort them?


I did something similar a few years ago. I can't remember why or how successful it was, but I'll post it here with no guarantees.

I don't think it actually sorts them into order, I think what it does is to put a range of tapes MU0000-MU9999 into the slot numbers that match the labels. It's not exactly what you asked for and it's certainly a bit rough and ready, but it might make a good starting point for further development.

#!/bin/ksh
typeset -i slot
nsrjb | while read origslot vol gash; do
        if [ -n "$(echo $vol | grep "^MU[0-9][0-9][0-9][0-9]")" ]; then
                vol=$(echo $vol | sed 's/(R)//')
                slot=$(echo $vol | sed 's/MU//')
                origslot=$(echo $origslot | sed 's/://')
                if [ $slot = $origslot ]; then
                        echo "Volume $vol is in correct slot $slot"
                elif [ $vol = MU0000 ]; then
                        echo "No slot for tape MU0000"
                else
                        echo "Withdrawing tape $vol from slot $origslot"
                        nsrjb -wN $vol
                        echo "Withdrawing tape from slot $slot"
                        nsrjb -wN -S$slot
                        echo "Depositing to slot $slot"
                        nsrjb -dN -S $slot
                        nsrjb -dN
                fi
        fi
done

To sign off this list, send email to listserv AT listserv.temple DOT edu and type 
"signoff networker" in the
body of the email. Please write to networker-request AT listserv.temple DOT edu 
if you have any problems
wit this list. You can access the archives at 
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

<Prev in Thread] Current Thread [Next in Thread>