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
29 exec_prefix="@exec_prefix@"
31 amlibexecdir="@amlibexecdir@"
32 . "${amlibexecdir}/amanda-sh-lib.sh"
34 # add sbin and ucb dirs
35 PATH="$PATH:/usr/sbin:/sbin:/usr/ucb"
41 if [ -d "@AMANDA_DBGDIR@" ]; then
42 DBGFILE=@AMANDA_DBGDIR@/rait-changer.debug
43 KIDDEBUG=@AMANDA_DBGDIR@/changer.debug
44 WORK=@AMANDA_DBGDIR@/chgwork$$
52 echo `_ "arguments: "` $0 $* >&2
55 USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@"
56 if test "$USE_VERSION_SUFFIXES" = "yes"; then
61 getconf=$sbindir/amgetconf$SUF
64 changerfile=`$getconf changerfile`
68 # get config items that other changers use to put in our
69 # fake amanda.conf files.
72 mailto=`$getconf mailto`
75 # make a working directory (with amanda.conf) for each changer, and start the
76 # changer script in background for each one
80 while [ $i -le $nchangers ]
82 eval tpchanger=\$tpchanger_$i
83 eval changerdev=\$changerdev_$i
84 eval changerfile=\$changerfile_$i
85 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