MT=//usr/bin/mt MTF=-f MTX=mtx + test -n TMPDIR=/tmp/amanda DBGDIR=/tmp/amanda argv0=chg-zd-mtx + expr chg-zd-mtx : .*/\(.*\) myname= + pwd config=/usr/local/share/amanda/Daily + expr /usr/local/share/amanda/Daily : .*/\(.*\) config=Daily + date +%H:%M:%S ds=17:06:01 + [ 0 -eq 0 -a -n 17:06:01 ] + echo 17:06:01 + sed s/./ /g logprefix= internal_call=0 mtx_status_valid=0 slot_list= prefix=/usr/local exec_prefix=/usr/local sbindir=/usr/local/sbin libexecdir=/usr/local/libexec PATH=/usr/local/sbin:/usr/local/libexec:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ucb:/usr/local/bin + export PATH USE_VERSION_SUFFIXES=no + test no = yes SUF= + amgetconf dbopen.chg-zd-mtx + grep -v BUGGY DBGFILE=/tmp/amanda/chg-zd-mtx.20030303170601.debug + [ -z /tmp/amanda/chg-zd-mtx.20030303170601.debug ] + amgetconf changerfile + grep -v BUGGY changerfile=/usr/local/share/amanda/Daily/chg-zd-mtx + [ -z /usr/local/share/amanda/Daily/chg-zd-mtx ] + amgetconf tapedev + grep -v BUGGY tape=/dev/rmt/1n + [ -z /dev/rmt/1n ] + expr /dev/rmt/1n : null: + [ /dev/rmt/1n = /dev/null -o 0 -eq 5 ] + amgetconf changerdev + grep -v BUGGY TAPE=/dev/scsi/changer/c1t6do + [ -z /dev/scsi/changer/c1t6do ] + [ /dev/scsi/changer/c1t6do = /dev/null ] + export TAPE configfile=/usr/local/share/amanda/Daily/chg-zd-mtx.conf cleanfile=/usr/local/share/amanda/Daily/chg-zd-mtx-clean accessfile=/usr/local/share/amanda/Daily/chg-zd-mtx-access slotfile=/usr/local/share/amanda/Daily/chg-zd-mtx-slot labelfile=/usr/local/share/amanda/Daily/chg-zd-mtx-barcodes + [ ! -s /usr/local/share/amanda/Daily/chg-zd-mtx-clean ] + [ ! -s /usr/local/share/amanda/Daily/chg-zd-mtx-access ] + [ ! -s /usr/local/share/amanda/Daily/chg-zd-mtx-slot ] + [ ! -f /usr/local/share/amanda/Daily/chg-zd-mtx-barcodes ] + cat /usr/local/share/amanda/Daily/chg-zd-mtx-clean cleancount=0 + cat /usr/local/share/amanda/Daily/chg-zd-mtx-access accesscount=2 varlist= varlist= firstslot varlist= firstslot lastslot varlist= firstslot lastslot cleanslot varlist= firstslot lastslot cleanslot cleancycle varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause AUTOCLEAN varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause AUTOCLEAN autoclean varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause AUTOCLEAN autoclean autocleancount varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause AUTOCLEAN autoclean autocleancount havereader varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause AUTOCLEAN autoclean autocleancount havereader driveslot varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause AUTOCLEAN autoclean autocleancount havereader driveslot poll_drive_ready varlist= firstslot lastslot cleanslot cleancycle OFFLINE_BEFORE_UNLOAD offline_before_unload unloadpause AUTOCLEAN autoclean autocleancount havereader driveslot poll_drive_ready max_drive_wait + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*firstslot[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*firstslot[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val=1 + eval firstslot="1" firstslot=1 + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*lastslot[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*lastslot[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf val=9 + eval lastslot="9" lastslot=9 + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*cleanslot[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*cleanslot[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val=10 + eval cleanslot="10" cleanslot=10 + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*cleancycle[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*cleancycle[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval cleancycle="" cleancycle= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*OFFLINE_BEFORE_UNLOAD[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*OFFLINE_BEFORE_UNLOAD[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval OFFLINE_BEFORE_UNLOAD="" OFFLINE_BEFORE_UNLOAD= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*offline_before_unload[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*offline_before_unload[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval offline_before_unload="" offline_before_unload= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*unloadpause[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*unloadpause[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval unloadpause="" unloadpause= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*AUTOCLEAN[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*AUTOCLEAN[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval AUTOCLEAN="" AUTOCLEAN= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*autoclean[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*autoclean[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval autoclean="" autoclean= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*autocleancount[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*autocleancount[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval autocleancount="" autocleancount= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*havereader[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*havereader[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval havereader="" havereader= + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*driveslot[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*driveslot[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf val=0 + eval driveslot="0" driveslot=0 + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*poll_drive_ready[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*poll_drive_ready[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval poll_drive_ready="" poll_drive_ready= + cat /usr/local/share/amanda/Daily/chg-zd-mtx.conf + sed -n # Ignore comment lines (anything starting with a #). /^[ ]*#/d # Find the first var=val line in the file, print the value and quit. /^[ ]*max_drive_wait[ ]*=[ ]*\([^ ][^ ]*\).*/ { s/^[ ]*max_drive_wait[ ]*=[ ]*\([^ ][^ ]*\).*/\1/p q } val= + eval max_drive_wait="" max_drive_wait= + [ -z 0 ] + [ /tmp/amanda/chg-zd-mtx.20030303170601.debug = /dev/null ] + [ -z 0 ] stdout=/tmp/amanda/.1.18875 stderr=/tmp/amanda/.2.18875 mtx_status=/tmp/amanda/.status.18875 + trap rm -f /tmp/amanda/.1.18875 /tmp/amanda/.2.18875 /tmp/amanda/.status.18875 0 + Log Arg info: + [ -z ] + date +%H:%M:%S ds=17:06:01 + echo 17:06:01 Arg info: + LogAppend $# = 1 + [ -z ] + echo $# = 1 i=0 + LogAppend $0 = "chg-zd-mtx" + [ -z ] + echo $0 = "chg-zd-mtx" + expr 0 + 1 i=1 + LogAppend $1 = "-info" + [ -z ] + echo $1 = "-info" firstslot=1 lastslot=9 cleanslot=10 cleancycle=120 + [ -z -a -n ] offline_before_unload=0 unloadpause=0 + [ -z -a -n ] autoclean=0 autocleancount=99 havereader=0 poll_drive_ready=3 max_drive_wait=120 + get_slot_list + test -n + [ -n ] + get_mtx_status + test -n + [ 0 -ne 0 ] + rm -f /tmp/amanda/.status.18875 + Run mtx status status=0 + [ 0 -eq 0 ] mtx_status_valid=1 + return 0 + sed -n /^Data Transfer Element:Full/ { s/.*(Storage Element \([0-9][0-9]*\) Loaded)\(.*\)/\1/p } /^Data Transfer Element 0:Full/ { s/.*(Storage Element \([0-9][0-9]*\) Loaded)\(.*\)/\1/p } /^[ ]*Storage Element \([0-9][0-9]*\):Full/ { s/.*Storage Element \([0-9][0-9]*\):.*/\1/p } + grep -v ^10$ + sort -n slot_list=1 2 3 4 5 6 7 8 9 + echo 1 2 3 4 5 6 7 8 9 slot_list=1 2 3 4 5 6 7 8 9 + [ 1 -lt 0 -o 9 -lt 0 ] amanda_slot_list= + [ 1 -ge 1 -a 1 -le 9 ] amanda_slot_list= 1 + [ 2 -ge 1 -a 2 -le 9 ] amanda_slot_list= 1 2 + [ 3 -ge 1 -a 3 -le 9 ] amanda_slot_list= 1 2 3 + [ 4 -ge 1 -a 4 -le 9 ] amanda_slot_list= 1 2 3 4 + [ 5 -ge 1 -a 5 -le 9 ] amanda_slot_list= 1 2 3 4 5 + [ 6 -ge 1 -a 6 -le 9 ] amanda_slot_list= 1 2 3 4 5 6 + [ 7 -ge 1 -a 7 -le 9 ] amanda_slot_list= 1 2 3 4 5 6 7 + [ 8 -ge 1 -a 8 -le 9 ] amanda_slot_list= 1 2 3 4 5 6 7 8 + [ 9 -ge 1 -a 9 -le 9 ] amanda_slot_list= 1 2 3 4 5 6 7 8 9 + [ -z 1 2 3 4 5 6 7 8 9 ] slot_list= 1 2 3 4 5 6 7 8 9 + Log Config info: + [ -z ] + date +%H:%M:%S ds=17:06:01 + echo 17:06:01 Config info: + [ firstslot = OFFLINE_BEFORE_UNLOAD ] + [ firstslot = AUTOCLEAN ] + eval val="$firstslot" val=1 + [ -z 1 ] + IsNumeric 1 + test -z 1 + expr 1 : \([-0-9][0-9]*\) x=1 + expr X1 != X1 + return 0 + : + LogAppend firstslot = "1" + [ -z ] + echo firstslot = "1" + [ lastslot = OFFLINE_BEFORE_UNLOAD ] + [ lastslot = AUTOCLEAN ] + eval val="$lastslot" val=9 + [ -z 9 ] + IsNumeric 9 + test -z 9 + expr 9 : \([-0-9][0-9]*\) x=9 + expr X9 != X9 + return 0 + : + LogAppend lastslot = "9" + [ -z ] + echo lastslot = "9" + [ cleanslot = OFFLINE_BEFORE_UNLOAD ] + [ cleanslot = AUTOCLEAN ] + eval val="$cleanslot" val=10 + [ -z 10 ] + IsNumeric 10 + test -z 10 + expr 10 : \([-0-9][0-9]*\) x=10 + expr X10 != X10 + return 0 + : + LogAppend cleanslot = "10" + [ -z ] + echo cleanslot = "10" + [ cleancycle = OFFLINE_BEFORE_UNLOAD ] + [ cleancycle = AUTOCLEAN ] + eval val="$cleancycle" val=120 + [ -z 120 ] + IsNumeric 120 + test -z 120 + expr 120 : \([-0-9][0-9]*\) x=120 + expr X120 != X120 + return 0 + : + LogAppend cleancycle = "120" + [ -z ] + echo cleancycle = "120" + [ OFFLINE_BEFORE_UNLOAD = OFFLINE_BEFORE_UNLOAD ] + continue + [ offline_before_unload = OFFLINE_BEFORE_UNLOAD ] + [ offline_before_unload = AUTOCLEAN ] + eval val="$offline_before_unload" val=0 + [ -z 0 ] + IsNumeric 0 + test -z 0 + expr 0 : \([-0-9][0-9]*\) x=0 + expr X0 != X0 + return 0 + : + LogAppend offline_before_unload = "0" + [ -z ] + echo offline_before_unload = "0" + [ unloadpause = OFFLINE_BEFORE_UNLOAD ] + [ unloadpause = AUTOCLEAN ] + eval val="$unloadpause" val=0 + [ -z 0 ] + IsNumeric 0 + test -z 0 + expr 0 : \([-0-9][0-9]*\) x=0 + expr X0 != X0 + return 0 + : + LogAppend unloadpause = "0" + [ -z ] + echo unloadpause = "0" + [ AUTOCLEAN = OFFLINE_BEFORE_UNLOAD ] + [ AUTOCLEAN = AUTOCLEAN ] + continue + [ autoclean = OFFLINE_BEFORE_UNLOAD ] + [ autoclean = AUTOCLEAN ] + eval val="$autoclean" val=0 + [ -z 0 ] + IsNumeric 0 + test -z 0 + expr 0 : \([-0-9][0-9]*\) x=0 + expr X0 != X0 + return 0 + : + LogAppend autoclean = "0" + [ -z ] + echo autoclean = "0" + [ autocleancount = OFFLINE_BEFORE_UNLOAD ] + [ autocleancount = AUTOCLEAN ] + eval val="$autocleancount" val=99 + [ -z 99 ] + IsNumeric 99 + test -z 99 + expr 99 : \([-0-9][0-9]*\) x=99 + expr X99 != X99 + return 0 + : + LogAppend autocleancount = "99" + [ -z ] + echo autocleancount = "99" + [ havereader = OFFLINE_BEFORE_UNLOAD ] + [ havereader = AUTOCLEAN ] + eval val="$havereader" val=0 + [ -z 0 ] + IsNumeric 0 + test -z 0 + expr 0 : \([-0-9][0-9]*\) x=0 + expr X0 != X0 + return 0 + : + LogAppend havereader = "0" + [ -z ] + echo havereader = "0" + [ driveslot = OFFLINE_BEFORE_UNLOAD ] + [ driveslot = AUTOCLEAN ] + eval val="$driveslot" val=0 + [ -z 0 ] + IsNumeric 0 + test -z 0 + expr 0 : \([-0-9][0-9]*\) x=0 + expr X0 != X0 + return 0 + : + LogAppend driveslot = "0" + [ -z ] + echo driveslot = "0" + [ poll_drive_ready = OFFLINE_BEFORE_UNLOAD ] + [ poll_drive_ready = AUTOCLEAN ] + eval val="$poll_drive_ready" val=3 + [ -z 3 ] + IsNumeric 3 + test -z 3 + expr 3 : \([-0-9][0-9]*\) x=3 + expr X3 != X3 + return 0 + : + LogAppend poll_drive_ready = "3" + [ -z ] + echo poll_drive_ready = "3" + [ max_drive_wait = OFFLINE_BEFORE_UNLOAD ] + [ max_drive_wait = AUTOCLEAN ] + eval val="$max_drive_wait" val=120 + [ -z 120 ] + IsNumeric 120 + test -z 120 + expr 120 : \([-0-9][0-9]*\) x=120 + expr X120 != X120 + return 0 + : + LogAppend max_drive_wait = "120" + [ -z ] + echo max_drive_wait = "120" + [ 1 -gt 9 ] + [ 0 -ne 0 -a 10 -lt 0 ] + cat /usr/local/share/amanda/Daily/chg-zd-mtx-slot currentslot=2 + IsNumeric 2 + test -z 2 + expr 2 : \([-0-9][0-9]*\) x=2 + expr X2 != X2 + return 0 + [ 2 -lt 1 ] + [ 2 -gt 9 ] found_current=0 first_slot_in_list=-1 next_slot_after_current=-1 + [ -1 -lt 0 ] first_slot_in_list=1 + [ 1 -eq 2 ] + [ 1 -gt 2 ] + [ 1 -lt 0 ] + [ 2 -eq 2 ] found_current=1 + break + [ 1 -eq 0 ] + [ 1 -lt 1 ] cmd=-info + shift + info + test -n + get_loaded_info + test -n + get_mtx_status + test -n + [ 1 -ne 0 ] + return 0 + sed -n /^Data Transfer Element:Empty/ { s/.*/-1/p q } /^Data Transfer Element 0:Empty/ { s/.*/-1/p q } /^Data Transfer Element:Full.*:VolumeTag/ { s/.*(Storage Element \([0-9][0-9]*\) Loaded):VolumeTag *= *\([^ ]*\)/\1 \2/p q } /^Data Transfer Element 0:Full.*:VolumeTag/ { s/.*(Storage Element \([0-9][0-9]*\) Loaded):VolumeTag *= *\([^ ]*\)/\1 \2/p q } /^Data Transfer Element:Full/ { s/.*(Storage Element \([0-9][0-9]*\) Loaded)\(.*\)/\1/p q } /^Data Transfer Element 0:Full/ { s/.*(Storage Element \([0-9][0-9]*\) Loaded)\(.*\)/\1/p q } + set x -1 + shift loadedslot=-1 loadedbarcode= + [ -z -1 ] + IsNumeric -1 + test -z -1 + expr -1 : \([-0-9][0-9]*\) x=-1 + expr X-1 != X-1 + return 0 + : + Log STATUS -> currently loaded slot = -1 + [ -z ] + date +%H:%M:%S ds=17:06:02 + echo 17:06:02 STATUS -> currently loaded slot = -1 + LogAppend -> currently loaded barcode = "" + [ -z ] + echo -> currently loaded barcode = "" + get_slot_list + test -n + [ -n 1 2 3 4 5 6 7 8 9 ] + return + Log INFO -> first slot: 1 + [ -z ] + date +%H:%M:%S ds=17:06:02 + echo 17:06:02 INFO -> first slot: 1 + LogAppend -> current slot: 2 + [ -z ] + echo -> current slot: 2 + LogAppend -> loaded slot: -1 + [ -z ] + echo -> loaded slot: -1 + LogAppend -> last slot: 9 + [ -z ] + echo -> last slot: 9 + LogAppend -> slot list: 1 2 3 4 5 6 7 8 9 + [ -z ] + echo -> slot list: 1 2 3 4 5 6 7 8 9 + LogAppend -> can go backwards: 1 + [ -z ] + echo -> can go backwards: 1 + LogAppend -> havereader: 0 + [ -z ] + echo -> havereader: 0 reader= + [ 0 -eq 1 ] + [ 2 -lt 1 -o 2 -gt 9 ] + set x 1 2 3 4 5 6 7 8 9 + shift numslots=9 + Exit 0 2 9 1 + [ 0 -gt 0 ] call_type=Exit code=0 + shift exit_slot=2 + shift exit_answer=9 1 + Log Exit (0) -> 2 9 1 + [ -z ] + date +%H:%M:%S ds=17:06:02 + echo 17:06:02 Exit (0) -> 2 9 1 + echo 2 9 1 2 9 1 + [ Exit = Return ] + amgetconf dbclose.chg-zd-mtx:/tmp/amanda/chg-zd-mtx.20030303170601.debug + exit 0 + rm -f /tmp/amanda/.1.18875 /tmp/amanda/.2.18875 /tmp/amanda/.status.18875