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
50 scripts/check_for_zombie_jobs storage=DDS-4
52 # We need to stop and start Bacula to
53 # test appending to a previously written tape
55 bin/bacula stop 2>&1 >/dev/null
56 bin/bacula start 2>&1 >/dev/null
57 for i in `cat ${cwd}/tmp/restore2-list`; do
58 diff $i ${cwd}/tmp/bacula-restores$i
63 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
65 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
67 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
70 echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
71 echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
73 bin/bacula stop 2>&1 >/dev/null
76 echo " First of two restores OK "
78 rm -rf ${cwd}/tmp/bacula-restores
80 # Now do a second backup and restore
82 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
86 run job=NightlySave level=Full yes
93 restore where=${cwd}/tmp/bacula-restores
95 <${cwd}/tmp/restore2-list
103 scripts/check_for_zombie_jobs storage=DDS-4
104 bin/bacula stop 2>&1 >/dev/null
105 for i in `cat ${cwd}/tmp/restore2-list`; do
106 diff $i ${cwd}/tmp/bacula-restores$i
107 if [ $? != 0 ] ; then
111 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
113 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
115 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
118 echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
119 echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
122 echo " ===== restore-by-file-tape test Bacula source OK ===== "
123 echo " ===== restore-by-file-tape test OK ===== " >>test.out