Amanda-Users

Re: MTX on FreeBSD using mtx-changer with ARCHIVE 4586 COMPAQ 28887-XXX

2002-08-06 15:15:23
Subject: Re: MTX on FreeBSD using mtx-changer with ARCHIVE 4586 COMPAQ 28887-XXX
From: Jon LaBadie <jon AT jgcomp DOT com>
To: amanda-users AT amanda DOT org
Date: Tue, 6 Aug 2002 15:04:18 -0400
On Tue, Aug 06, 2002 at 09:05:52AM -0500, Chris Tusa wrote:
> Hi All,
> 
> This is the same results mtx produces 'mtx status':
> 
>  Storage Changer /dev/changer:1 Drives, 4 Slots ( 0 Import/Export ) Data 
> Transfer Element 0:Empty
>        Storage Element 1:Full
>        Storage Element 2:Full
>        Storage Element 3:Full
>        Storage Element 4:Full"
> 
> Perhaps I need to modify one of these scripts?  Does anyone have a similar 
> system or have experience working with Amanda with MTX on FreeBSD to steer me 
> in the right direction?

Chris,
I'm guessing your chg-mtx script has something similar
to mine for the readstatus function:

    readstatus() {
        used=`$MTX -s |
            sed -n 's/Drive: No tape Loaded/-1/p;s/Drive: tape \(.\) 
loaded/\1/p'`

        if [ -z "$used" ]; then
                used="-1";
        fi
    }

It may be "$MTX status" instead of "$MTX -s" as different mtx's take different 
options.

The problem is your device outputs different text than this little function
was written to handle.  You need to customize it to match your mtx output.
Note the output of my "mtx -s" command.  Very different from yours.

        slot_1  Full
        slot_2  Full
        slot_3  Full
        slot_4  Full
        slot_5  Full
        slot_6  Empty
        Drive: tape 6 loaded

The objective of the function is to get the number from the last line
or -1 if no tape is loaded.  The corresponding data in your output is
in line 1.  I'm assuming the line that begins "Storage Changer" is really
a single line all the way to "0:Empty" despite the split in the email.

>  Storage Changer /dev/changer:1 Drives, 4 Slots ( 0 Import/Export ) Data 
> Transfer Element 0:Empty

        used=`$MTX -s | sed -n \
                -e '/Transfer Element.*:Empty/s/.*/-1/p'    \
                -e '/Transfer 
Element.*:.*[0-9]/s/.*:[^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1/p'    \
                `

The first editor expression handles the line if it has "transfer element empty",
changing the entire line to a -1.

The second looks for transfer element followed by a number and changes the
entire line to that number.

Both assume I got it right :)

jon
-- 
Jon H. LaBadie                  jon AT jgcomp DOT com
 JG Computing
 4455 Province Line Road        (609) 252-0159
 Princeton, NJ  08540-4322      (609) 683-7220 (fax)

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