I have installed mtx at /usr/local/bin/mtx and edited an updated chg-mtx script to reflect this and placed it in /usr/local/libexec. when I run amtape daily current I get the result: amtape: could not get changer info: :No such file or directory. I have not been able to figure out what amtape is not finding. amtape.debug is little help - repeats the error. If the tpchanger variable is set to "/usr/local/libexec/chg-mtx the error changes to: amtape: could not get changer info: could not read result from "/usr/local/libexec/chg-mtx" and the amtape .debug is the same I put a couple of echo statements in chg-mtx to at least start to get an idea of where the script was failing, but they aren't even touched. Having fought most of today and yesterday with chg-scsi (which refuses to change and then actually read a tape, but will happily read the existing tape all day long...) and now chg-mtx, I am frankly stumped and looking at the task of having to write a changer glue script. Which should NOT be necessary, this should work. Below are the amanda.conf entries and the chg-mtx script... Any help would be MUCH appreciated. --doug The entries in amanda.conf for the changer are: runtapes 2 # number of tapes to be used in a single run of amdump #tpchanger "chg-manual" # the tape-changer glue script #tpchanger "chg-scsi" # the tape-changer glue script tpchanger "chg-mtx" # the tape-changer glue script tapedev "/dev/nst0" # the no-rewind tape device to be used #tapedev "0" # the no-rewind tape device to be used #rawtapedev "/dev/st0" # the raw device to be used (ftape only) changerfile "/usr/local/etc/amanda/changer.conf" #changerdev "/dev/sg1" #this is defined in the config file tapetype VXA-17 # what kind of tape it is (see tapetypes below) labelstr "^Daily-Set1-[0-9][0-9]*$" # label constraint regex: all tapes must match the mtx script is: #!/bin/bash # # Exit Status: # 0 Alles Ok # 1 Illegal Request # 2 Fatal Error # # Contributed by Eric DOUTRELEAU [EMAIL PROTECTED] # This is supposed to work with Zubkoff/Dandelion version of mtx # # Modified by Joe Rhett [EMAIL PROTECTED] # to work with MTX 1.2.9 by Eric Lee Green http://mtx.sourceforge.net # #testing... echo `date` > /tmp/mtx-debug echo "point 1" >> /tmp/mtx-debug # You may need to customize these things MT=/bin/mt MTF=-f MTX=/usr/local/bin/mtx DD=/bin/dd firstslot=1 lastslot=15 cleanslot=15 accessbeforeclean=100 # No user-level customized required beyond this point. # try to hit all the possibilities here prefix=/usr/local exec_prefix=${prefix} sbindir=${exec_prefix}/sbin libexecdir=${exec_prefix}/libexec PATH=$sbindir:$libexecdir:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ucb:/usr/local/bin export PATH if [ -d "/tmp/amanda" ]; then DBGFILE=/tmp/amanda/mtx-changer.debug echo `date` >> $DBGFILE else DBGFILE=/dev/null fi USE_VERSION_SUFFIXES="no" if test "$USE_VERSION_SUFFIXES" = "yes"; then SUF="-2.4.2b2" else SUF= fi myname=$0 tape=`amgetconf$SUF tapedev` TAPE=`amgetconf$SUF changerdev`; export TAPE # for mtx command if [ "$tape" = "/dev/null" -o "$TAPE" = "/dev/null" ]; then echo "Both tapedev and changerdev must be specified in config file"; exit 2; fi changerfile=`amgetconf$SUF changerfile` cleanfile=$changerfile-clean accessfile=$changerfile-access slotfile=$changerfile-slot [ ! -f $cleanfile ] && echo 0 > $cleanfile [ ! -f $accessfile ] && echo 0 > $accessfile [ ! -f $slotfile ] && echo 0 > $slotfile cleancount=`cat $cleanfile` accesscount=`cat $accessfile` # Routines start here readstatus() { usedslot=`$MTX status | sed -n 's/Data Transfer Element 0:Empty/-1/p;s/Data Transfer Element 0:Full (Storage Element \(.\) Loaded)/\1/p'` if [ "$usedslot" -eq "-1" ]; then echo '-1' > $slotfile fi echo "STATUS -> currently loaded slot = $usedslot" >> $DBGFILE } eject() { readstatus echo "EJECT -> ejecting tape from slot $usedslot" >> $DBGFILE if [ $usedslot -gt 0 ]; then $MTX unload $usedslot 2>/dev/null echo "0 $tape" exit 0 else echo "0 Drive was not loaded" exit 1 fi } reset() { readstatus if [ $usedslot -gt 0 ]; then echo "RESET -> ejecting tape from slot $usedslot" >> $DBGFILE $MTX unload $usedslot 2>/dev/null fi echo "RESET -> loading tape from slot 1" >> $DBGFILE result=`$MTX load 1 2>&1` if [ $? -eq 0 ]; then echo "1 $tape" exit 0 else echo "1 $result" exit 1 fi } loadslot() { readstatus whichslot=$1 echo "LOADSLOT -> load tape from slot $whichslot" >> $DBGFILE case $whichslot in current) if [ $usedslot -lt 0 ]; then loadslot=$firstslot else echo "$usedslot $tape" exit 0 fi ;; next|advance) if [ $usedslot -lt 0 ]; then loadslot=$firstslot else loadslot=`expr $usedslot + 1` if [ $loadslot -gt $lastslot ]; then loadslot=$firstslot fi fi ;; prev) loadslot=`expr $usedslot - 1` if [ $loadslot -lt $firstslot ]; then loadslot=$lastslot fi ;; first) loadslot=$firstslot ;; last) loadslot=$lastslot ;; [${firstslot}-${lastslot}]) loadslot=$1 ;; clean) loadslot=$cleanslot ;; *) echo "0 illegal request" exit 1 ;; esac # Is this already the current slot? if [ $loadslot = $usedslot ]; then echo "$usedslot $tape" exit 0 fi # Is this a cleaning request? if [ $loadslot = $cleanslot ]; then expr $cleancount + 1 > $cleanfile echo 0 > $accessfile else expr $accesscount + 1 > $accessfile if [ $accesscount -gt $accessbeforeclean ]; then $myname -slot clean >/dev/null # Slot $cleanslot might contain an ordinary tape rather than a cleaning # tape. A cleaning tape *MIGHT* auto-eject; an ordinary tape does not. # We therefore have to read the status again to check what actually happened. readstatus fi fi # Unload any previous tape if [ $usedslot -ne "-1" ]; then echo " -> unload $usedslot" >> $DBGFILE result=`$MTX unload $usedslot 2>&1` status=$? echo " -> status $status, result '$result'" >> $DBGFILE if [ $status -ne 0 ]; then echo "$loadslot $result" exit 2 fi fi # Load the tape, finally! echo " -> loading tape from slot $loadslot" >> $DBGFILE result=`$MTX load $loadslot 2>&1` status=$? echo " -> status $status, result '$result'" >> $DBGFILE # If there is an error, abort unless the slot is simply empty if [ $status -ne 0 ]; then empty=`echo $result | grep "is Empty"` if [ -z "$empty" ]; then echo "$loadslot $result" exit 2 else loadslot next fi else # Don't assume the drive is ready until we stop getting tape offline readyError="offline" while [ -n "$readyError" ]; do readyStatus=`$MT $MTF $tape status 2>&1` echo " -> readyStatus = $readyStatus" >> $DBGFILE readyError=`echo $readyStatus | grep "offline"` done # Now rewind and check echo " -> rewind $loadslot" >> $DBGFILE $MT $MTF $tape rewind echo "$loadslot" > $slotfile echo "$loadslot $tape" exit 0 fi } info() { readstatus echo "INFO -> current slot $usedslot, last slot $lastslot, can go backwards 1" >> $DBGFILE if [ $usedslot -lt 0 ]; then echo "0 $lastslot 1" else echo "$usedslot $lastslot 1" fi exit 0 } # Program invocation begins here echo "\n`date` Invoked with args '$@'" >> $DBGFILE while [ $# -ge 1 ];do case $1 in -slot) shift loadslot $* ;; -info) shift info ;; -reset) shift reset ;; -eject) shift eject ;; *) echo "Unknown option $1" exit 2 ;; esac done Doug Munsinger egenera, Inc. [EMAIL PROTECTED] 563 Main Street, Bolton, MA 01740 Tel: 508-786-9444 ext. 2612 OR 508-481-5493 fax: 978 779-9730
