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 scripts/copy-tape-confs
12 echo "${cwd}/build" >/tmp/file-list
13 sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
15 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
16 sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
20 echo " === Starting restore-by-file-tape test `date +%R:%S` ==="
21 echo " === Starting restore-by-file-tape test `date +%R:%S` ===" >>working/log
24 bin/bacula start 2>&1 >/dev/null
25 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
29 label storage=DDS-4 volume=TestVolume001 slot=0
30 run job=NightlySave level=Full yes
37 restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list
45 scripts/check_for_zombie_jobs storage=DDS-4
47 # We need to stop and start Bacula to
48 # test appending to a previously written tape
50 bin/bacula stop 2>&1 >/dev/null
51 bin/bacula start 2>&1 >/dev/null
52 for i in `cat ${cwd}/tmp/restore2-list`; do
53 diff $i ${cwd}/tmp/bacula-restores$i
58 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
60 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
62 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
65 echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
66 echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
68 bin/bacula stop 2>&1 >/dev/null
71 echo " First of two restores OK "
73 rm -rf ${cwd}/tmp/bacula-restores
75 # Now do a second backup and restore
77 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
81 run job=NightlySave level=Full yes
88 restore where=${cwd}/tmp/bacula-restores
90 <${cwd}/tmp/restore2-list
98 scripts/check_for_zombie_jobs storage=DDS-4
99 bin/bacula stop 2>&1 >/dev/null
100 for i in `cat ${cwd}/tmp/restore2-list`; do
101 diff $i ${cwd}/tmp/bacula-restores$i
102 if [ $? != 0 ] ; then
106 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
108 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
110 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
113 echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
114 echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
117 echo " ===== restore-by-file-tape test Bacula source OK ===== "
118 echo " ===== restore-by-file-tape test OK ===== " >>test.out