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