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 "$debug" -eq 1 ; then
15 bin/bacula stop 2>&1 >/dev/null
17 ./drop_bacula_tables >/dev/null 2>&1
18 ./make_bacula_tables >/dev/null 2>&1
19 ./grant_bacula_privileges 2>&1 >/dev/null
22 scripts/copy-2drive-confs
23 scripts/cleanup-2drive
24 echo "${cwd}/tmp/build" >/tmp/file-list
25 if test ! -d ${cwd}/tmp/build ; then
26 mkdir ${cwd}/tmp/build
28 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
30 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
31 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
36 echo " === Starting 2drive-incremental-2tape test ==="
37 echo " === Starting 2drive-incremental-2tape test ===" >>working/log
40 # Write out bconsole commands
41 cat <<END_OF_DATA >tmp/bconcmds
45 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
46 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
47 run job=NightlySave yes
54 if test "$debug" -eq 1 ; then
56 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
58 bin/bacula start 2>&1 >/dev/null
59 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
61 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
62 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
64 cat <<END_OF_DATA >tmp/bconcmds
68 @# Force Incremental on the second Volume
69 update volume=TestVolume001 VolStatus=Used
71 run level=Incremental job=NightlySave yes
79 restore where=${cwd}/tmp/bacula-restores
81 <${cwd}/tmp/restore-list
89 if test "$debug" -eq 1 ; then
91 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
93 bin/bacula start 2>&1 >/dev/null
94 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
97 bin/bacula stop 2>&1 >/dev/null
98 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
100 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
103 # Delete .c files because we will only restored the txt files
106 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
107 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
110 echo " !!!!! 2drive-incremental-2tape test Bacula source failed!!! !!!!! "
111 echo " !!!!! 2drive-incremental-2tape test failed!!! !!!!! " >>test.out
114 echo " ===== 2drive-incremental-2tape test Bacula source OK ===== "
115 echo " ===== 2drive-incremental-2tape test OK ===== " >>test.out