]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-incremental-2disk
79f711a6ba722ad13449bca0bfefeaa149eafb16
[bacula/bacula] / regress / tests / 2drive-incremental-2disk
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then create some           
4 #   new files, do an Incremental and restore those two files.
5 #
6 # This script uses the virtual disk autochanger and two drives
7 #
8 TestName="2drive-incremental-2disk"
9 JobName="2drive2disk"
10 . scripts/functions
11
12 scripts/cleanup
13 scripts/copy-2disk-drive-confs
14 scripts/prepare-two-disks
15
16 change_jobname localhost-fd $JobName
17 start_test
18
19 echo "${cwd}/tmp/build" >/tmp/file-list
20 if test ! -d ${cwd}/tmp/build ; then
21    mkdir ${cwd}/tmp/build
22 fi
23 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
24 cd ${cwd}/tmp
25 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
26 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
27 cd ${cwd}
28
29 # Turn off Prefer Mounted Volumes so we use 2 drives
30 outf="tmp/sed_tmp"
31 echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
32 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
33 # Comment the next line out to write everything to one drive
34 #  otherwise, it writes the two jobs to different drives
35 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
36
37 # Write out bconsole commands
38 cat <<END_OF_DATA >tmp/bconcmds
39 @output /dev/null
40 messages
41 @$out tmp/log1.out
42 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
43 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
44 status storage=DDS-4
45 @#setdebug level=120 storage=DDS-4
46 run job=NightlySave yes
47 run job=NightlySave yes
48 run job=NightlySave yes
49 run job=NightlySave yes
50 run job=NightlySave yes
51 @sleep 3
52 status storage=DDS-4
53 wait
54 list volumes
55 list jobs
56 status storage=DDS-4
57 messages
58 quit
59 END_OF_DATA
60
61 run_bacula
62 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
63 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
64
65 cat <<END_OF_DATA >tmp/bconcmds
66 @$out /dev/null
67 messages
68 @$out tmp/log1.out
69 @# Force Incremental on the second Volume
70 update volume=TestVolume001 VolStatus=Used
71 status storage=DDS-4
72 @#setdebug level=120 storage=DDS-4
73 run level=Incremental job=NightlySave yes
74 wait
75 list volumes
76 status storage=DDS-4
77 messages
78 @# 
79 @# now do a restore
80 @#
81 @$out tmp/log2.out
82 restore where=${cwd}/tmp/bacula-restores 
83 7
84 <${cwd}/tmp/restore-list
85
86 yes
87 wait
88 messages
89 @$out
90 quit
91 END_OF_DATA
92
93 run_bconsole
94 check_for_zombie_jobs storage=DDS-4
95 stop_bacula
96
97 check_two_logs
98 # The restore should read from TestVolume002, which was on drive 1
99 grep tmp/log2.out TestVolume002
100 if [ $? != 0 ] ; then
101    rstat=$?
102 fi
103
104 #
105 # Delete .c files because we will only restored the txt files
106 #
107 rm -f tmp/build/*.c
108 check_restore_tmp_build_diff
109
110 end_test