3 # Run a basejob backup of the Bacula build directory
7 TestName="base-job-test"
13 echo 's/backup_advance/base_backup/' > $tmp/s
14 echo 's/Name = backup/Name = backup; Base = base_backup, backup/' >> $tmp/s
15 sed -f $tmp/s $rscripts/bacula-dir.conf.accurate > $conf/bacula-dir.conf
18 sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
19 cp tmp/1 $conf/bacula-fd.conf
21 change_jobname BackupClient1 $JobName
24 echo "##############################################" >> ${cwd}/tmp/log1.out
25 echo "$*" >> ${cwd}/tmp/log1.out
26 echo "##############################################" >> ${cwd}/tmp/log2.out
27 echo "$*" >> ${cwd}/tmp/log2.out
31 rm -rf ${cwd}/build/accurate.new
32 rm -rf ${cwd}/build/accurate
36 mkdir ${cwd}/build/accurate
37 mkdir ${cwd}/build/accurate/dirtest
38 echo "test test" > ${cwd}/build/accurate/dirtest/hello
39 echo "test test" > ${cwd}/build/accurate/xxx
40 echo "test test" > ${cwd}/build/accurate/yyy
41 echo "test test" > ${cwd}/build/accurate/zzz
42 echo "test test" > ${cwd}/build/accurate/zzzzzz
43 echo "test test" > ${cwd}/build/accurate/xxxxxx
44 echo "test test" > ${cwd}/build/accurate/yyyyyy
45 echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
46 echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
47 echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
48 echo ${cwd}/build > ${cwd}/tmp/file-list
52 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
55 label volume=TestVolume001 storage=File pool=Default
61 ################################################################
62 p Now do a backup using base backup
63 ################################################################
65 echo ${cwd}/bin >> ${cwd}/tmp/file-list
67 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
68 @$out ${cwd}/tmp/log1.out
69 run job=base_backup level=base yes
72 update volume=TestVolume001 volstatus=Used
77 echo ${cwd}/build > ${cwd}/tmp/file-list
79 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
80 @$out ${cwd}/tmp/log4.out
81 label volume=TestVolume002 storage=File pool=Default
82 run job=backup level=full yes
88 @$out ${cwd}/tmp/log2.out
89 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
97 check_for_zombie_jobs storage=File
102 rm -rf ${cwd}/tmp/bacula-restores
104 grep -e 'FD Bytes Written: *0' ${cwd}/tmp/log4.out > /dev/null
105 if [ $? -ne 0 ]; then
106 print_debug "ERROR: The first full job should have 0 byte in log4.out"
110 grep -e 'Using BaseJobId(s): 1$' ${cwd}/tmp/log4.out > /dev/null
111 if [ $? -ne 0 ]; then
112 print_debug "ERROR: The first full job should use only jobid=1 as basejob"
116 ################################################################
117 p Now do a backup after making few changes
118 ################################################################
119 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
120 @$out ${cwd}/tmp/log1.out
121 update volume=TestVolume002 volstatus=Used
122 label volume=TestVolume003 storage=File pool=Default
123 run job=backup level=incremental yes
129 @$out ${cwd}/tmp/log2.out
130 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
136 rm ${cwd}/build/accurate/yyyyyy # delete a file
137 rm -rf ${cwd}/build/accurate/dirtest
141 check_for_zombie_jobs storage=File
145 check_files_written ${cwd}/tmp/log1.out 4
147 rm -rf ${cwd}/tmp/bacula-restores
149 ################################################################
151 ################################################################
152 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
153 @$out ${cwd}/tmp/log3.out
155 SELECT count(*) FROM BaseFiles;
157 purge volume=TestVolume002
160 SELECT count(*) FROM BaseFiles;
166 grep -e ' 0 *|' ${cwd}/tmp/log3.out > /dev/null
167 if [ $? -ne 0 ]; then
168 print_debug "Can't purge the base job"
173 ################################################################
175 ################################################################
177 touch ${cwd}/build/po/fr.po
179 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
180 run level=full job=backup yes
183 @out ${cwd}/tmp/log5.out
184 list basefiles jobid=6
185 @out ${cwd}/tmp/log6.out
192 grep "po/fr.po^" ${cwd}/tmp/log5.out > /dev/null
193 if [ $? -eq 0 ]; then
194 print_debug "Should not display fr.po as basefile"
198 export bstat dstat estat