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 autochanger and two tapes
9 if test x${TAPE_DRIVE1} = x/dev/null ; then
10 echo "Skipping 2drive-incremenatal-2tape test. No second drive."
14 if test "$debug" -eq 1 ; then
20 bin/bacula stop 2>&1 >/dev/null
22 ./drop_bacula_tables >/dev/null 2>&1
23 ./make_bacula_tables >/dev/null 2>&1
24 ./grant_bacula_privileges 2>&1 >/dev/null
27 scripts/copy-2drive-confs
28 scripts/cleanup-2drive
29 echo "${cwd}/tmp/build" >/tmp/file-list
30 if test ! -d ${cwd}/tmp/build ; then
31 mkdir ${cwd}/tmp/build
33 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
35 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
36 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
39 # Turn off Prefer Mounted Volumes so we use 2 drives
41 echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf}
42 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
43 # Comment the next line out to write everything to one drive
44 # otherwise, it writes the two jobs to different drives
45 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
49 echo " === Starting 2drive-incremental-2tape test ==="
50 echo " === Starting 2drive-incremental-2tape test ===" >>working/log
53 # Write out bconsole commands
54 cat <<END_OF_DATA >tmp/bconcmds
58 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
59 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
60 @#setdebug level=100 storage=DDS-4
61 run job=NightlySave yes
62 run job=NightlySave yes
63 run job=NightlySave yes
64 run job=NightlySave yes
65 run job=NightlySave yes
76 if test "$debug" -eq 1 ; then
78 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
80 bin/bacula start 2>&1 >/dev/null
81 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
83 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
84 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
86 cat <<END_OF_DATA >tmp/bconcmds
90 @# Force Incremental on the second Volume
91 update volume=TestVolume001 VolStatus=Used
93 @#setdebug level=400 storage=DDS-4
94 run level=Incremental job=NightlySave yes
103 restore where=${cwd}/tmp/bacula-restores
105 <${cwd}/tmp/restore-list
113 if test "$debug" -eq 1 ; then
114 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
116 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
119 bin/bacula stop 2>&1 >/dev/null
120 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
122 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
125 # Delete .c files because we will only restored the txt files
128 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
129 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
132 echo " !!!!! 2drive-incremental-2tape test Bacula source failed!!! !!!!! "
133 echo " !!!!! 2drive-incremental-2tape test failed!!! !!!!! " >>test.out
136 echo " ===== 2drive-incremental-2tape test Bacula source OK ===== "
137 echo " ===== 2drive-incremental-2tape test OK ===== " >>test.out