3 # Run a simple backup of the Bacula build directory
4 # to a tape where the maximum tape file size is set to 1M
5 # then restore a few files from it. Note, by setting the maximum
6 # file size to 1M, it runs very slow. There are about 64 files that
7 # are created during each of the two backups.
10 bin/bacula stop 2>&1 >/dev/null
11 scripts/copy-tape-confs
13 echo "${cwd}/build" >/tmp/file-list
14 sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
16 ./drop_bacula_tables >/dev/null 2>&1
17 ./make_bacula_tables >/dev/null 2>&1
18 ./grant_bacula_privileges 2>&1 >/dev/null
20 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
21 sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
25 echo " === Starting restore-by-file-tape test ==="
26 echo " === Starting restore-by-file-tape test ===" >>working/log
29 bin/bacula start 2>&1 >/dev/null
30 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
34 label storage=DDS-4 volume=TestVolume001 slot=0
35 run job=NightlySave level=Full yes
42 restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list
51 # We need to stop and start Bacula to
52 # test appending to a previously written tape
54 bin/bacula stop 2>&1 >/dev/null
55 bin/bacula start 2>&1 >/dev/null
56 for i in `cat ${cwd}/tmp/restore2-list`; do
57 diff $i ${cwd}/tmp/bacula-restores$i
62 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
64 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
66 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
69 echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
70 echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
72 bin/bacula stop 2>&1 >/dev/null
75 echo " First of two restores OK "
77 rm -rf ${cwd}/tmp/bacula-restores
79 # Now do a second backup and restore
81 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
85 run job=NightlySave level=Full yes
92 restore where=${cwd}/tmp/bacula-restores
94 <${cwd}/tmp/restore2-list
102 bin/bacula stop 2>&1 >/dev/null
103 for i in `cat ${cwd}/tmp/restore2-list`; do
104 diff $i ${cwd}/tmp/bacula-restores$i
105 if [ $? != 0 ] ; then
109 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
111 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
113 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
116 echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
117 echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
120 echo " ===== restore-by-file-tape test Bacula source OK ===== "
121 echo " ===== restore-by-file-tape test OK ===== " >>test.out