3 # Run a basejob backup of the Bacula build directory
7 TestName="base-job-test"
13 sed 's/backup_advance/base_backup/' $rscripts/bacula-dir.conf.accurate > $tmp/1
14 sed 's/Name = backup/Name = backup; Base = base_backup, backup/' $tmp/1 > $conf/bacula-dir.conf
15 sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
16 cp tmp/1 $conf/bacula-fd.conf
18 change_jobname BackupClient1 $JobName
21 echo "##############################################" >> ${cwd}/tmp/log1.out
22 echo "$*" >> ${cwd}/tmp/log1.out
23 echo "##############################################" >> ${cwd}/tmp/log2.out
24 echo "$*" >> ${cwd}/tmp/log2.out
28 rm -rf ${cwd}/build/accurate.new
29 rm -rf ${cwd}/build/accurate
33 mkdir ${cwd}/build/accurate
34 mkdir ${cwd}/build/accurate/dirtest
35 echo "test test" > ${cwd}/build/accurate/dirtest/hello
36 echo "test test" > ${cwd}/build/accurate/xxx
37 echo "test test" > ${cwd}/build/accurate/yyy
38 echo "test test" > ${cwd}/build/accurate/zzz
39 echo "test test" > ${cwd}/build/accurate/zzzzzz
40 echo "test test" > ${cwd}/build/accurate/xxxxxx
41 echo "test test" > ${cwd}/build/accurate/yyyyyy
42 echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
43 echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
44 echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
45 echo ${cwd}/build > ${cwd}/tmp/file-list
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 label volume=TestVolume001 storage=File pool=Default
58 ################################################################
59 p Now do a backup using base backup
60 ################################################################
62 echo ${cwd}/bin >> ${cwd}/tmp/file-list
64 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
65 @$out ${cwd}/tmp/log1.out
66 run job=base_backup level=base yes
69 update volume=TestVolume001 volstatus=Used
74 echo ${cwd}/build > ${cwd}/tmp/file-list
76 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
77 @$out ${cwd}/tmp/log4.out
78 label volume=TestVolume002 storage=File pool=Default
79 run job=backup level=full yes
85 @$out ${cwd}/tmp/log2.out
86 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
94 check_for_zombie_jobs storage=File
99 rm -rf ${cwd}/tmp/bacula-restores
101 grep -e 'FD Bytes Written: *0' ${cwd}/tmp/log4.out > /dev/null
102 if [ $? -ne 0 ]; then
103 print_debug "The first full job should have 0 byte in log4.out"
107 ################################################################
108 p Now do a backup after making few changes
109 ################################################################
110 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
111 @$out ${cwd}/tmp/log1.out
112 update volume=TestVolume002 volstatus=Used
113 label volume=TestVolume003 storage=File pool=Default
114 run job=backup level=incremental yes
120 @$out ${cwd}/tmp/log2.out
121 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
127 rm ${cwd}/build/accurate/yyyyyy # delete a file
128 rm -rf ${cwd}/build/accurate/dirtest
132 check_for_zombie_jobs storage=File
136 check_files_written ${cwd}/tmp/log1.out 4
138 rm -rf ${cwd}/tmp/bacula-restores
140 ################################################################
142 ################################################################
143 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
144 @$out ${cwd}/tmp/log3.out
146 SELECT count(*) FROM BaseFiles;
148 purge volume=TestVolume002
151 SELECT count(*) FROM BaseFiles;
157 grep -e ' 0 *|' ${cwd}/tmp/log3.out > /dev/null
158 if [ $? -ne 0 ]; then
159 print_debug "Can't purge the base job"
164 ################################################################
166 ################################################################
168 touch ${cwd}/build/po/fr.po
170 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
171 run level=full job=backup yes
174 @$out ${cwd}/tmp/log5.out
175 list basefiles jobid=6
176 @$out ${cwd}/tmp/log6.out
183 grep po/fr.po ${cwd}/tmp/log5.out > /dev/null
184 if [ $? -eq 0 ]; then
185 print_debug "Should not display fr.po as basefile"