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 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
59 @$out ${cwd}/tmp/log1.out
60 run job=backup level=full yes
66 @$out ${cwd}/tmp/log2.out
67 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
74 ################################################################
75 p First : We just run a full backup and restore
76 ################################################################
79 check_for_zombie_jobs storage=File
84 rm -rf ${cwd}/tmp/bacula-restores
86 ################################################################
87 p Now do a second backup using base backup
88 ################################################################
90 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
91 @$out ${cwd}/tmp/log1.out
92 run job=base_backup level=base yes
95 update volume=TestVolume001 volstatus=Used
96 label volume=TestVolume002 storage=File pool=Default
97 run job=backup level=full yes
103 @$out ${cwd}/tmp/log2.out
104 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
112 check_for_zombie_jobs storage=File
117 rm -rf ${cwd}/tmp/bacula-restores
119 ################################################################
120 p Now do a third backup after making few changes
121 ################################################################
122 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
123 @$out ${cwd}/tmp/log1.out
124 update volume=TestVolume002 volstatus=Used
125 label volume=TestVolume003 storage=File pool=Default
126 run job=backup level=incremental yes
132 @$out ${cwd}/tmp/log2.out
133 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
139 rm ${cwd}/build/accurate/yyyyyy # delete a file
140 rm -rf ${cwd}/build/accurate/dirtest
144 check_for_zombie_jobs storage=File
148 check_files_written ${cwd}/tmp/log1.out 4
150 rm -rf ${cwd}/tmp/bacula-restores
153 ################################################################
155 ################################################################
156 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
157 @$out ${cwd}/tmp/log3.out
159 SELECT count(*) FROM BaseFiles;
161 purge volume=TestVolume002
164 SELECT count(*) FROM BaseFiles;
170 grep -e ' 0 *|' ${cwd}/tmp/log3.out > /dev/null
171 if [ $? -ne 0 ]; then
172 print_debug "Can't purge the base job"