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 "The first full job should have 0 byte in log4.out"
110 ################################################################
111 p Now do a backup after making few changes
112 ################################################################
113 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
114 @$out ${cwd}/tmp/log1.out
115 update volume=TestVolume002 volstatus=Used
116 label volume=TestVolume003 storage=File pool=Default
117 run job=backup level=incremental yes
123 @$out ${cwd}/tmp/log2.out
124 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
130 rm ${cwd}/build/accurate/yyyyyy # delete a file
131 rm -rf ${cwd}/build/accurate/dirtest
135 check_for_zombie_jobs storage=File
139 check_files_written ${cwd}/tmp/log1.out 4
141 rm -rf ${cwd}/tmp/bacula-restores
143 ################################################################
145 ################################################################
146 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
147 @$out ${cwd}/tmp/log3.out
149 SELECT count(*) FROM BaseFiles;
151 purge volume=TestVolume002
154 SELECT count(*) FROM BaseFiles;
160 grep -e ' 0 *|' ${cwd}/tmp/log3.out > /dev/null
161 if [ $? -ne 0 ]; then
162 print_debug "Can't purge the base job"
167 ################################################################
169 ################################################################
171 touch ${cwd}/build/po/fr.po
173 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
174 run level=full job=backup yes
177 @$out ${cwd}/tmp/log5.out
178 list basefiles jobid=6
179 @$out ${cwd}/tmp/log6.out
186 grep po/fr.po ${cwd}/tmp/log5.out > /dev/null
187 if [ $? -eq 0 ]; then
188 print_debug "Should not display fr.po as basefile"