--- /dev/null
+#!/bin/sh
+#
+# Run all tape tests
+#
+tests/test0
+tests/backup-bacula-tape
+tests/small-file-size-tape
+echo " "
+echo " "
+echo "Test results"
+cat test.out
+scripts/cleanup
test-bacula-sd.conf
test-console.conf
testa-bacula-dir.conf
+bacula-dir-tape.conf
+bacula-sd-tape.conf
+cleanup-tape
--- /dev/null
+#
+# Default Bacula Director Configuration file
+#
+# The only thing that MUST be changed is to add one or more
+# file or directory names in the Include directive of the
+# FileSet resource.
+#
+# For Bacula release 1.30 (12 April 2003) -- redhat 7.3
+#
+# You might also want to change the default email address
+# from root to your address. See the "mail" and "operator"
+# directives in the Messages resource.
+#
+
+Director { # define myself
+ Name = @hostname@-dir
+ DIRport = 8101 # where we listen for UA connections
+ QueryFile = "@scriptdir@/query.sql"
+ WorkingDirectory = "@working_dir@"
+ PidDirectory = "@piddir@"
+ Maximum Concurrent Jobs = 4
+ Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3"
+ Messages = Standard
+}
+
+#
+# Define the main nightly save backup job
+# By default, this job will back up to disk in /tmp
+Job {
+ Name = "NightlySave"
+ Type = Backup
+ Client=@hostname@-fd
+ FileSet="Full Set"
+ Storage = DDS-4
+ Messages = Standard
+ Pool = Default
+ Write Bootstrap = "@working_dir@/NightlySave.bsr"
+ Maximum Concurrent Jobs = 4
+}
+
+
+# Standard Restore template, to be changed by Console program
+Job {
+ Name = "RestoreFiles"
+ Type = Restore
+ Client=@hostname@-fd
+ FileSet="Full Set"
+ Storage = DDS-4
+ Messages = Standard
+ Pool = Default
+ Where = /tmp/bacula-restores
+}
+
+
+# List of files to be backed up
+FileSet {
+ Name = "Full Set"
+ Include = signature=MD5 {
+ </tmp/file-list
+ }
+}
+
+
+#
+# When to do the backups, full backup on first sunday of the month,
+# differential (i.e. incremental since full) every other sunday,
+# and incremental backups other days
+Schedule {
+ Name = "WeeklyCycle"
+ Run = Full 1st sun at 1:05
+ Run = Differential 2nd-5th sun at 1:05
+ Run = Incremental mon-sat at 1:05
+}
+
+# Client (File Services) to backup
+Client {
+ Name = @hostname@-fd
+ Address = @hostname@
+ FDPort = 8102
+ Catalog = MyCatalog
+ Password = "xevrjURYoCHhn26RaJoWbeWXEY/a3VqGKp/37tgWiuHc" # password for FileDaemon
+ File Retention = 30d # 30 days
+ Job Retention = 180d # six months
+ AutoPrune = yes # Prune expired Jobs/Files
+ Maximum Concurrent Jobs = 4
+}
+
+# Definition of DDS tape storage device
+Storage {
+ Name = DDS-4
+ Address = @hostname@ # N.B. Use a fully qualified name here
+ SDPort = 8103
+ Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" # password for Storage daemon
+ Device = DDS-4 # must be same as Device in Storage daemon
+ Media Type = DDS-4 # must be same as MediaType in Storage daemon
+ AutoChanger = yes
+}
+
+
+# Generic catalog service
+Catalog {
+ Name = MyCatalog
+ dbname = bacula; user = bacula; password = ""
+}
+
+# Reasonable message delivery -- send most everything to email address
+# and to the console
+Messages {
+ Name = Standard
+ mailcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
+ operatorcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
+ MailOnError = @job_email@ = all
+ operator = @job_email@ = mount
+ console = all, !skipped
+#
+# WARNING! the following will create a file that you must cycle from
+# time to time as it will grow indefinitely. However, it will
+# also keep all your messages if the scroll off the console.
+#
+ append = "@working_dir@/log" = all, !skipped
+}
+
+
+# Default pool definition
+Pool {
+ Name = Default
+ Pool Type = Backup
+ Recycle = yes # Bacula can automatically recycle Volumes
+ AutoPrune = yes # Prune expired volumes
+ Volume Retention = 365d # one year
+ Accept Any Volume = yes # write on any volume in the pool
+}
--- /dev/null
+#
+# Default Bacula Storage Daemon Configuration file
+#
+# For Bacula release 1.30 (12 April 2003) -- redhat 7.3
+#
+# You may need to change the name of your tape drive
+# on the "Archive Device" directive in the Device
+# resource. If you change the Name and/or the
+# "Media Type" in the Device resource, please ensure
+# that dird.conf has corresponding changes.
+#
+
+Storage { # definition of myself
+ Name = @hostname@-sd
+ SDPort = 8103 # Director's port
+ WorkingDirectory = "@working_dir@"
+ Pid Directory = "@piddir@"
+ Subsys Directory = "@subsysdir@"
+}
+
+#
+# List Directors who are permitted to contact Storage daemon
+#
+Director {
+ Name = @hostname@-dir
+ Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"
+}
+
+#
+# Devices supported by this Storage daemon
+# To connect, the Director's bacula-dir.conf must have the
+# same Name and MediaType.
+#
+
+Device {
+ Name = DDS-4 #
+ Media Type = DDS-4
+ Changer Device = /dev/sg0
+ Changer Command ="@scriptdir@/mtx-changer %c %o %S %a"
+ Archive Device = @tape_drive@
+ AutomaticMount = yes; # when device opened, read it
+ AlwaysOpen = yes;
+ RemovableMedia = yes;
+# Maximum File Size = 1000000
+}
+
+#
+# Send all messages to the Director,
+# mount messages also are sent to the email address
+#
+Messages {
+ Name = Standard
+ director = @hostname@-dir = all
+}
rm -rf /tmp/TestVolume001 /tmp/bacula-restores /tmp/Small*
rm -rf tmp/original tmp/bacula-restores tmp/Small* tmp/TestVolume*
rm -rf tmp/restored tmp/largefile tmp/bscan.bsr tmp/log*.out
+rm -rf /tmp/sed_tmp /tmp/file-list
--- /dev/null
+#!/bin/sh
+#
+# Cleanup left over files -- both before and after test run
+#
+rm -rf /tmp/TestVolume001 /tmp/bacula-restores /tmp/Small*
+rm -rf tmp/original tmp/bacula-restores tmp/Small* tmp/TestVolume*
+rm -rf tmp/restored tmp/largefile tmp/bscan.bsr tmp/log*.out
+
+mt -f @tape_drive@ rewind
+mt -f @tape_drive@ weof
--- /dev/null
+#!/bin/sh
+/bin/cp -f scripts/bacula-dir-tape.conf bin/bacula-dir.conf
+/bin/cp -f scripts/bacula-sd-tape.conf bin/bacula-sd.conf
+/bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf
+/bin/cp -f scripts/test-console.conf bin/console.conf
#!/bin/sh
#
-if test $# != 1 ; then
+if test $# != 2 ; then
echo "First arg must be email name"
+ echo " and the second must be a tape drive"
exit 1
fi
out="/tmp/sed_tmp"
echo "s%@piddir@%${cwd}/working%g" >>${out}
echo "s%@subsysdir@%${cwd}/working%g" >>${out}
echo "s%@job_email@%${1}%g" >>${out}
+echo "s%@tape_drive@%${2}%g" >>${out}
echo "s%@tmpdir@%${cwd}/tmp%g" >>${out}
echo "s%@hostname@%${host}%g" >>${out}
sed -f ${out} ${cwd}/scripts/test-bacula-fd.conf.in >${cwd}/scripts/test-bacula-fd.conf
sed -f ${out} ${cwd}/scripts/test-bacula-sd.conf.in >${cwd}/scripts/test-bacula-sd.conf
sed -f ${out} ${cwd}/scripts/test-console.conf.in >${cwd}/scripts/test-console.conf
+sed -f ${out} ${cwd}/scripts/bacula-dir-tape.conf.in >${cwd}/scripts/bacula-dir-tape.conf
+sed -f ${out} ${cwd}/scripts/bacula-sd-tape.conf.in >${cwd}/scripts/bacula-sd-tape.conf
+sed -f ${out} ${cwd}/scripts/cleanup-tape.in >${cwd}/scripts/cleanup-tape
+chmod 777 ${cwd}/scripts/cleanup-tape
rm -f ${out}
--- /dev/null
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory
+# to a tape then restore it.
+#
+cwd=`pwd`
+bin/bacula stop 2>&1 >/dev/null
+scripts/copy-tape-confs
+scripts/cleanup-tape
+echo "${cwd}/build" >/tmp/file-list
+bin/drop_sqlite_tables
+bin/make_sqlite_tables
+
+echo " "
+echo " "
+echo " === Starting Bacula tape test ==="
+echo " === Starting Bacula tape test ===" >>working/log
+echo " "
+
+bin/bacula start 2>&1 >/dev/null
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+label storage=DDS-4 volume=TestVolume001 slot=0
+run job=NightlySave yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@output tmp/log2.out
+restore current all
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+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
+if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
+ echo " "
+ echo " "
+ echo " !!!!! Bacula tape test Bacula source failed!!! !!!!! "
+ echo " !!!!! Bacula tape test failed!!! !!!!! " >>test.out
+ echo " "
+else
+ echo " ===== Bacula tape test Bacula source OK ===== "
+ echo " ===== Bacula tape test OK ===== " >>test.out
+ scripts/cleanup
+fi
@output /dev/null
messages
@output tmp/log1.out
-label storage=File1
-TestVolume001
-label storage=File1
-TestVolume002
-update Volume=TestVolume001
-6
-3000000
-10
-run job=NightlySave storage=File1
-yes
+label storage=File1 volume=TestVolume001
+label storage=File1 volume=TestVolume002
+update Volume=TestVolume001 MaxVolBytes=3000000
+run job=NightlySave storage=File1 yes
wait
messages
@#
@output /dev/null
messages
@output tmp/log1.out
-label storage=File1
-TestVolume001
-label storage=File1
-TestVolume002
-update Volume=TestVolume001
-6
-3000000
-10
-run job=NightlySave storage=File1
-yes
+label storage=File1 volume=TestVolume001
+label storage=File1 volume=TestVolume002
+update Volume=TestVolume001 MaxVolBytes=3000000
+run job=NightlySave storage=File1 yes
wait
messages
@#
@output /dev/null
messages
@output tmp/log1.out
-label storage=File
-TestVolume001
-run job=CompressedTest
-yes
+label storage=File volume=TestVolume001
+run job=CompressedTest yes
wait
messages
@#
@output /dev/null
messages
@output tmp/log1.out
-label storage=File
-TestVolume001
-run job=CompressedTest level=Full
-yes
-run job=CompressedTest level=Full
-yes
-run job=CompressedTest level=Full
-yes
-run job=CompressedTest level=Full
-yes
+label storage=File volume=TestVolume001
+run job=CompressedTest level=Full yes
+run job=CompressedTest level=Full yes
+run job=CompressedTest level=Full yes
+run job=CompressedTest level=Full yes
wait
messages
@#
@output /dev/null
messages
@output tmp/log1.out
-run job=MultiVol storage=File
-yes
+run job=MultiVol storage=File yes
wait
messages
@#
--- /dev/null
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory
+# to a tape where the maximum tape file size is set to 1M
+#
+cwd=`pwd`
+bin/bacula stop 2>&1 >/dev/null
+scripts/copy-tape-confs
+scripts/cleanup-tape
+echo "${cwd}/build" >/tmp/file-list
+bin/drop_sqlite_tables
+bin/make_sqlite_tables
+out="/tmp/sed_tmp"
+echo "s%# Maximum File Size% Maximum File Size%g" >${out}
+cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
+sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
+
+echo " "
+echo " "
+echo " === Starting Small File Size test ==="
+echo " === Starting Small File Size test ===" >>working/log
+echo " "
+
+#bin/bacula start 2>&1 >/dev/null
+bin/bacula start
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+label storage=DDS-4 volume=TestVolume001 slot=0
+run job=NightlySave yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@output tmp/log2.out
+restore current all
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+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
+if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
+ echo " "
+ echo " "
+ echo " !!!!! Small File Size test Bacula source failed!!! !!!!! "
+ echo " !!!!! Small File Size test failed!!! !!!!! " >>test.out
+ echo " "
+else
+ echo " ===== Small File Size test Bacula source OK ===== "
+ echo " ===== Small File Size test OK ===== " >>test.out
+# scripts/cleanup
+fi
@output /dev/null
messages
@output tmp/log1.out
-label storage=File
-TestVolume001
-run job=SparseCompressedTest
-yes
+label storage=File volume=TestVolume001
+run job=SparseCompressedTest yes
wait
messages
@#
@# now do a restore
@#
@output tmp/log2.out
-restore
-5
-done
+restore current all
yes
wait
messages
@output /dev/null
messages
@output tmp/log1.out
-label storage=File
-TestVolume001
-run job=SparseTest
-yes
+label storage=File volume=TestVolume001
+run job=SparseTest yes
wait
messages
@#
estimate job=CompressedTest listing
messages
@output tmp/log1.out
-label storage=File
-TestVolume001
-run job=CompressedTest
-yes
+label storage=File volume=TestVolume001
+run job=CompressedTest yes
wait
messages
quit
--- /dev/null
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory
+# to two tapes where the maximum tape file size is set to 1M
+#
+cwd=`pwd`
+bin/bacula stop 2>&1 >/dev/null
+scripts/copy-tape-confs
+mtx -f /dev/sg0 unload
+mtx -f /dev/sg0 load 1
+mt -f /dev/nst0 rewind
+mt -f /dev/nst0 weof
+mtx -f /dev/sg0 unload
+mt -f /dev/sg0 load 2
+mt -f /dev/nst0 rewind
+mt -f /dev/nst0 weof
+mtx -f /dev/sg0 unload
+echo "${cwd}/build" >/tmp/file-list
+bin/drop_sqlite_tables
+bin/make_sqlite_tables
+out="/tmp/sed_tmp"
+echo "s%# Maximum File Size% Maximum File Size%g" >${out}
+cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
+sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
+
+echo " "
+echo " "
+echo " === Starting Two Volume Tape test ==="
+echo " === Starting Two Volume Tape test ===" >>working/log
+echo " "
+
+#bin/bacula start 2>&1 >/dev/null
+bin/bacula start
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@tee tmp/log1.out
+label storage=DDS-4 volume=TestVolume001 slot=1
+label storage=DDS-4 volume=TestVolume002 slot=2
+update Volume=TestVolume001 MaxVolBytes=3000000
+run job=NightlySave yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@tee tmp/log2.out
+restore current all
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+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
+if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
+ echo " "
+ echo " "
+ echo " !!!!! Two Volume Tape test Bacula source failed!!! !!!!! "
+ echo " !!!!! Two Volume Tape test failed!!! !!!!! " >>test.out
+ echo " "
+else
+ echo " ===== Two Volume Tape test Bacula source OK ===== "
+ echo " ===== Two Volume Tape test OK ===== " >>test.out
+# scripts/cleanup
+fi
@output /dev/null
messages
@output tmp/log1.out
-label storage=File
-TestVolume001
-run job=NightlySave
-yes
+label storage=File volume=TestVolume001
+run job=NightlySave yes
wait
messages
@#