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