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
8 if test ! -e /dev/nst1; then
9 echo "Skipping 2drive-incremenatal-2tape test"
13 if test "$debug" -eq 1 ; then
19 bin/bacula stop 2>&1 >/dev/null
21 ./drop_bacula_tables >/dev/null 2>&1
22 ./make_bacula_tables >/dev/null 2>&1
23 ./grant_bacula_privileges 2>&1 >/dev/null
26 scripts/copy-2drive-confs
27 scripts/cleanup-2drive
28 echo "${cwd}/tmp/build" >/tmp/file-list
29 if test ! -d ${cwd}/tmp/build ; then
30 mkdir ${cwd}/tmp/build
32 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
34 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
35 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
38 # Turn off Prefer Mounted Volumes so we use 2 drives
40 echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf}
41 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
42 # Comment the next line out to write everything to one drive
43 # otherwise, it writes the two jobs to different drives
44 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
48 echo " === Starting 2drive-incremental-2tape test ==="
49 echo " === Starting 2drive-incremental-2tape test ===" >>working/log
52 # Write out bconsole commands
53 cat <<END_OF_DATA >tmp/bconcmds
57 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
58 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
59 @#setdebug level=100 storage=DDS-4
60 run job=NightlySave yes
61 run job=NightlySave yes
69 if test "$debug" -eq 1 ; then
71 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
73 bin/bacula start 2>&1 >/dev/null
74 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
76 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
77 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
79 cat <<END_OF_DATA >tmp/bconcmds
83 @# Force Incremental on the second Volume
84 update volume=TestVolume001 VolStatus=Used
86 @#setdebug level=400 storage=DDS-4
87 run level=Incremental job=NightlySave yes
96 restore where=${cwd}/tmp/bacula-restores
98 <${cwd}/tmp/restore-list
106 if test "$debug" -eq 1 ; then
107 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
109 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
112 bin/bacula stop 2>&1 >/dev/null
113 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
115 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
118 # Delete .c files because we will only restored the txt files
121 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
122 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
125 echo " !!!!! 2drive-incremental-2tape test Bacula source failed!!! !!!!! "
126 echo " !!!!! 2drive-incremental-2tape test failed!!! !!!!! " >>test.out
129 echo " ===== 2drive-incremental-2tape test Bacula source OK ===== "
130 echo " ===== 2drive-incremental-2tape test OK ===== " >>test.out