5 # This assumes we have rait-striped drives in several
6 # other amanda changer configs.
8 # so we have a changerfile that lists other changers and
11 # tpchanger_1="chg-mtx"
12 # changerdev_1="/dev/mtx1"
13 # changerfile_1="/some/file1"
14 # tapedev_1="/some/dev"
15 # tpchanger_2="chg-mtx"
16 # changerdev_2="/dev/mtx2"
17 # changerfile_2="/some/file2"
18 # tapedev_2="/some/dev"
19 # tpchanger_3="chg-mtx"
20 # changerdev_3="/dev/mtx3"
21 # changerfile_3="/some/file3"
22 # tapedev_3="/some/dev"
24 # the tapedev_n entries are only needed if the changer script in question
31 if [ -d "@AMANDA_DBGDIR@" ]; then
32 DBGFILE=@AMANDA_DBGDIR@/rait-changer.debug
33 KIDDEBUG=@AMANDA_DBGDIR@/changer.debug
34 WORK=@AMANDA_DBGDIR@/chgwork$$
42 echo "args: $0 $*" >&2
46 # the usual config fun
49 exec_prefix=@exec_prefix@
51 libexecdir=@libexecdir@
53 USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@"
54 if test "$USE_VERSION_SUFFIXES" = "yes"; then
59 getconf=$sbindir/amgetconf$SUF
62 PATH=$sbindir:$libexecdir:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ucb
65 changerfile=`$getconf changerfile`
69 # get config items that other changers use to put in our
70 # fake amanda.conf files.
73 mailto=`$getconf mailto`
76 # make a working directory (with amanda.conf) for each changer, and start the
77 # changer script in background for each one
81 while [ $i -le $nchangers ]
83 eval tpchanger=\$tpchanger_$i
84 eval changerdev=\$changerdev_$i
85 eval changerfile=\$changerfile_$i
86 eval tapedev=\$tapedev_$i
91 cat >> amanda.conf <<EOF
94 tpchanger "$tpchanger"
95 changerdev "$changerdev"
96 changerfile "$changerfile"
99 define tapetype EXABYTE {
100 comment "default tapetype"
110 ) > stdout 2>stderr &
118 # once they've all finished, collect up the results
129 x-slot|x-reset|x-eject|x-search|x-label)
132 # read slot number and device from each
133 # slot numbers must match(?!), and is our resulting slot number
134 # resulting device is {dev1,dev2,...} from each one
137 while [ $i -le $nchangers ]
139 read exitcode < $WORK/$i/exitcode
140 read n dev < $WORK/$i/stdout
141 echo -------------- >&2
142 cat $WORK/$i/stderr >&2
144 echo -------------- >&2
146 if [ "$exitcode" != 0 ]
158 echo "stackers are out of synch, issue a reset" >&2
160 mydev="$mydev$mysep$dev"
170 # read info from each
171 # slot numbers must match(?!), and is our resulting slot number
172 # minimum max slots is our resulting max slots
173 # if any can't go backwards, the aggregate can't either
176 while [ $i -le $nchangers ]
178 read exitcode < $WORK/$i/exitcode
179 read n max flag < $WORK/$i/stdout
180 echo -------------- >&2
181 cat $WORK/$i/stderr >&2
183 echo -------------- >&2
185 if [ "$exitcode" != 0 ]
197 echo "stackers are out of synch, issue a -reset" >&2
199 if [ $max -lt $mymax ]
209 echo $myslot $mymax $myflag
214 # clean up work directories