3 # Run a simple backup of the Bacula build directory then create some
4 # new files, do an Incremental and restore those two files.
6 # This script uses the virtual disk autochanger and two drives
10 if test "$debug" -eq 1 ; then
16 bin/bacula stop 2>&1 >/dev/null
18 ./drop_bacula_tables >/dev/null 2>&1
19 ./make_bacula_tables >/dev/null 2>&1
20 ./grant_bacula_privileges 2>&1 >/dev/null
23 scripts/copy-2disk-drive-confs
24 scripts/prepare-two-disks
25 echo "${cwd}/tmp/build" >/tmp/file-list
26 if test ! -d ${cwd}/tmp/build ; then
27 mkdir ${cwd}/tmp/build
29 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
31 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
32 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
35 # Turn off Prefer Mounted Volumes so we use 2 drives
37 echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf}
38 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
39 # Comment the next line out to write everything to one drive
40 # otherwise, it writes the two jobs to different drives
41 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
45 echo " === Starting 2drive-incremental-2disk test ==="
46 echo " === Starting 2drive-incremental-2disk test ===" >>working/log
49 # Write out bconsole commands
50 cat <<END_OF_DATA >tmp/bconcmds
54 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
55 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
56 setdebug level=100 storage=DDS-4
57 run job=NightlySave yes
58 run job=NightlySave yes
59 run job=NightlySave yes
60 run job=NightlySave yes
61 run job=NightlySave yes
72 if test "$debug" -eq 1 ; then
74 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
76 bin/bacula start 2>&1 >/dev/null
77 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
79 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
80 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
82 cat <<END_OF_DATA >tmp/bconcmds
86 @# Force Incremental on the second Volume
87 update volume=TestVolume001 VolStatus=Used
89 @#setdebug level=400 storage=DDS-4
90 run level=Incremental job=NightlySave yes
99 restore where=${cwd}/tmp/bacula-restores
101 <${cwd}/tmp/restore-list
109 if test "$debug" -eq 1 ; then
110 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
112 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
115 bin/bacula stop 2>&1 >/dev/null
116 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
118 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
121 # Delete .c files because we will only restored the txt files
124 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
125 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
128 echo " !!!!! 2drive-incremental-2disk test Bacula source failed!!! !!!!! "
129 echo " !!!!! 2drive-incremental-2disk test failed!!! !!!!! " >>test.out
132 echo " ===== 2drive-incremental-2disk test Bacula source OK ===== "
133 echo " ===== 2drive-incremental-2disk test OK ===== " >>test.out