]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-incremental-2disk
684965c2c5aba961d5ff5ac72ef29b942abcbf30
[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" >${cwd}/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="${cwd}/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 >${cwd}/tmp/bconcmds
39 @output /dev/null
40 messages
41 @$out ${cwd}/tmp/log1.out
42 setdebug level=3 dir
43 setdebug level=3 storage=DDS-4
44 setdebug level=3 client=2drive2disk 
45 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
46 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
47 status storage=DDS-4
48 setdebug level=120 storage=DDS-4
49 run job=NightlySave yes
50 run job=NightlySave yes
51 run job=NightlySave yes
52 run job=NightlySave yes
53 run job=NightlySave yes
54 wait jobid=2
55 status storage=DDS-4
56 list volumes
57 list jobs
58 messages
59 wait
60 list volumes
61 list jobs
62 status storage=DDS-4
63 messages
64 quit
65 END_OF_DATA
66
67 run_bacula
68 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
69 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
70
71
72 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
73 @$out /dev/null
74 messages
75 @$out ${cwd}/tmp/log1.out
76 @# Force Incremental on the second Volume
77 update volume=TestVolume001 VolStatus=Used
78 status storage=DDS-4
79 list volumes
80 @#setdebug level=120 storage=DDS-4
81 run level=Incremental job=NightlySave yes
82 wait
83 list volumes
84 status storage=DDS-4
85 messages
86 @# 
87 @# now do a restore
88 @#
89 @$out ${cwd}/tmp/log2.out
90 restore where=${cwd}/tmp/bacula-restores 
91 7
92 <${cwd}/tmp/restore-list
93
94 yes
95 wait
96 messages
97 @$out
98 quit
99 END_OF_DATA
100
101 run_bconsole
102
103 check_for_zombie_jobs storage=DDS-4
104
105 stop_bacula
106
107 check_two_logs
108 # The restore should read from TestVolume002, which was on drive 1
109 grep TestVolume002 ${cwd}/tmp/log2.out >/dev/null 2>&1
110 # Note rstat may already be set, so we don't just store into it
111 if [ $? != 0 ] ; then
112    rstat=$?
113 fi
114
115 #
116 # Delete .c files because we will only restored the txt files
117 #
118 rm -f ${cwd}/tmp/build/*.c
119 check_restore_tmp_build_diff
120
121 end_test