echo " === Starting four-concurrent-jobs-tape at `date +%R:%S` ===" >>working/log
echo " "
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+#bin/bacula start 2>&1 >/dev/null
+bin/bacula start
+#bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+@tee /dev/null
messages
-@output tmp/log1.out
+@tee tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0
run job=NightlySave level=Full Storage=DDS-4 yes
run job=NightlySave level=Full Storage=DDS-4 yes
@#
@# now do a restore
@#
-@output tmp/log2.out
+@tee tmp/log2.out
restore where=${cwd}/tmp/bacula-restores select storage=DDS-4
unmark *
mark *
yes
wait
messages
-@output
+@tee
quit
END_OF_DATA
scripts/check_for_zombie_jobs storage=DDS-4
--- /dev/null
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory using the compressed option
+# then backup four times, each with incremental then finally restore.
+# It should require at least 4 different bsrs.
+#
+cwd=`pwd`
+
+scripts/copy-tape-confs
+scripts/cleanup-tape
+echo "${cwd}/build" >/tmp/file-list
+
+echo " "
+echo " "
+echo " === Starting relabel-tape at `date +%R:%S` ==="
+echo " === Starting relabel-tape at `date +%R:%S` ===" >>working/log
+echo " "
+
+bin/bacula start 2>&1 >/dev/null
+#bin/bacula start
+bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+#bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+label storage=DDS-4 volume=TestVolume001 slot=0
+run job=NightlySave level=Full yes
+wait
+messages
+add
+0
+TestVolume002
+0
+no
+update volume=TestVolume001
+1
+4
+.
+run job=NightlySave level=Full yes
+@sleep 20
+unmount
+unmount
+purge volume=TestVolume001
+relabel oldvolume=TestVolume001 volume=TestVolume003 slot=0
+list volumes
+messages
+wait
+messages
+@output
+quit
+END_OF_DATA
+echo "Backup done"
+#
+# now do several restores to ensure we cleanup between jobs
+#
+bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+@output /dev/null
+restore where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+restore where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+@output tmp/log2.out
+@#
+@# now unmount the tape and start two restores
+@# at the same time
+@#
+unmount storage=DDS-4
+restore where=${cwd}/tmp/bacula-restores select all done
+yes
+restore where=${cwd}/tmp/bacula-restores select
+unmark *
+mark *
+done
+yes
+mount storage=DDS-4
+wait
+messages
+@output
+quit
+END_OF_DATA
+scripts/check_for_zombie_jobs storage=DDS-4
+bin/bacula stop 2>&1 >/dev/null
+grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
+bstat=$?
+grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
+rstat=$?
+diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
+dstat=$?
+if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
+ echo " "
+ echo " "
+ echo " !!!!! relabel-tape Bacula source failed!!! !!!!! "
+ echo " !!!!! relabel-tape failed!!! !!!!! " >>test.out
+ echo "diff=$dstat backup=$bstat restore=$rstat"
+ echo " "
+else
+ echo " ===== relabel-tape Bacula source OK ===== "
+ echo " ===== relabel-tape OK ===== " >>test.out
+ scripts/cleanup
+fi