. scripts/functions
scripts/cleanup
-
-if test x@autochanger@ != x/dev/null; then
- slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
- if test "x${slot}" != "x$SLOT2"; then
- bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
- bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
- fi
-
- init_drive @tape_drive@
-fi
-
-
-#
-# If we have an autochanger always load tape in slot 1
-#
-if test x@autochanger@ != x/dev/null; then
- slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
- if test "x${slot}" != "x$SLOT1"; then
- bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
- bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
- fi
-fi
-
-init_drive @tape_drive@
-
+scripts/prepare-two-tapes
#!/bin/sh
#
-# Cleanup left over files -- both before and after test run
+# Cleanup left over files, then load $SLOT1 into drive and
+# write an EOF on it.
#
. scripts/functions
scripts/cleanup
-if test "x@autochanger@" != "x/dev/null" ; then
- a=`bin/@changer_script@ @autochanger@ loaded $SLOT1 @tape_drive@ 0`
- if test $a = 0 ; then
- bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ 0
- fi
+if test x@autochanger@ != x/dev/null; then
+ slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
+ case $slot in
+ 0)
+ bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+ ;;
+ $SLOT1)
+ ;;
+ default)
+ bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+ bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+ ;;
+ esac
fi
init_drive @tape_drive@
-
-
. ${cwd}/config
CLIENT=${HOST}-fd
+AUTOCHANGER_SCRIPT=${AUTOCHANGER_SCRIPT:-mtx-changer}
init_drive @tape_drive@
slot=$SLOT2
;;
+ default)
+ bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+ bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+ init_drive @tape_drive@
+ slot=$SLOT1
+ ;;
esac
# init the other slot
@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
label storage=DDS-4 volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
-update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=0
+update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=$DRIVE1
sql
select * from Storage;
select VolumeName,InChanger,Slot,StorageId from Media;
check_for_zombie_jobs storage=DDS-4
stop_bacula
-mt -f ${TAPE_DRIVE} rewind
-mtx -f ${AUTOCHANGER} unload
-sleep 15
+bin/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $SLOT2 ${TAPE_DRIVE} 0
cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null