3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a simple backup of the Bacula build directory then create some
9 # new files, do an Incremental and restore those two files.
11 # This script uses the autochanger and two drives
13 TestName="2drive-incremental-changer"
21 scripts/copy-2drive-confs
22 scripts/cleanup-2drive
24 change_jobname localhost-fd $JobName
26 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
27 if test ! -d ${cwd}/tmp/build ; then
28 mkdir -p ${cwd}/tmp/build
30 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
32 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
33 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
36 # Turn off Prefer Mounted Volumes so we use 2 drives
37 outf="${cwd}/tmp/sed_tmp"
38 echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf}
39 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
40 # Comment the next line out to write everything to one drive
41 # otherwise, it writes the two jobs to different drives
42 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
46 # Write out bconsole commands
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
50 @$out ${cwd}/tmp/log1.out
51 label storage=tape volume=TestVolume001 slot=$SLOT1 Pool=Default drive=$DRIVE1
52 label storage=tape volume=TestVolume002 slot=$SLOT2 Pool=Default drive=$DRIVE2
53 @#setdebug level=100 storage=tape
54 run job=NightlySave yes
55 run job=NightlySave yes
56 run job=NightlySave yes
57 run job=NightlySave yes
58 run job=NightlySave yes
71 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
72 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
74 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
77 @$out ${cwd}/tmp/log1.out
78 @# Force Incremental on the second Volume
79 update volume=TestVolume001 VolStatus=Used
81 @#setdebug level=400 storage=tape
82 run level=Incremental job=NightlySave yes
90 @$out ${cwd}/tmp/log2.out
91 restore where=${cwd}/tmp/bacula-restores
93 <${cwd}/tmp/restore-list
102 check_for_zombie_jobs storage=tape
107 # Delete .c files because we will only restored the txt files
109 rm -f ${cwd}/tmp/build/*.c
110 check_restore_tmp_build_diff