]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-tape
Final changes
[bacula/bacula] / regress / tests / bscan-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then backup four times, each with incremental then 
5 #   do a bscan and restore.
6 #   It should require at least 4 different bsrs.
7 #
8 cwd=`pwd`
9 scripts/copy-tape-confs
10 scripts/cleanup-tape
11 echo "${cwd}/build" >/tmp/file-list
12
13 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
14 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
15
16 echo " "
17 echo " "
18 echo " === Starting bscan-tape  ==="
19 echo " === Starting bscan-tape  ===" >>working/log
20 echo " "
21
22 bin/bacula start 2>&1 >/dev/null
23 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
24 @output /dev/null
25 estimate job=NightlySave listing
26 estimate job=NightlySave listing
27 estimate job=NightlySave listing
28 messages
29 @output tmp/log1.out
30 label storage=DDS-4 volume=TestVolume001 slot=0
31 run job=NightlySave yes
32 wait
33 run job=NightlySave level=Full yes
34 wait
35 run job=NightlySave level=Full yes
36 wait
37 messages
38 quit
39 END_OF_DATA
40 scripts/check_for_zombie_jobs storage=DDS-4
41 echo "Backup 1 done"
42 # make some files for the incremental to pick up
43 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
44 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
45    
46 #
47 # run a second job
48 #
49 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
50 @output /dev/null
51 messages
52 @output tmp/log1.out
53 run job=NightlySave level=Incremental yes
54 wait
55 messages
56 quit
57 END_OF_DATA
58 scripts/check_for_zombie_jobs storage=DDS-4
59 echo "Backup 2 done"
60 touch ${cwd}/build/src/dird/*.c
61 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
62 #
63 # run a third job
64 #
65 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
66 @output /dev/null
67 messages
68 @output tmp/log1.out
69 run job=NightlySave level=Incremental yes
70 wait
71 messages
72 quit
73 END_OF_DATA
74 scripts/check_for_zombie_jobs storage=DDS-4
75 echo "Backup 3 done"
76 # make some files for the incremental to pick up
77 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
78 #echo "abc" > ${cwd}/build/src/lib/dummy
79 #
80 # run a fourth job
81 #
82 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
83 @output /dev/null
84 messages
85 @output tmp/log1.out
86 run job=NightlySave level=Incremental yes
87 wait
88 messages
89 quit
90 END_OF_DATA
91 scripts/check_for_zombie_jobs storage=DDS-4
92 echo "Backup 4 done"
93 #
94 # now drop and recreate the database
95 #
96 cd bin
97 ./drop_bacula_tables >/dev/null 2>&1
98 ./make_bacula_tables >/dev/null 2>&1
99 ./grant_bacula_privileges 2>&1 >/dev/null
100 cd ..
101
102 bin/bacula stop 2>&1 >/dev/null
103 echo "volume=TestVolume001" >tmp/bscan.bsr
104 bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4 2>&1 >/dev/null
105 bin/bacula start 2>&1 >/dev/null
106 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
107 @output /dev/null
108 messages
109 @output tmp/log2.out
110 @# 
111 @# now do a restore
112 @#
113 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
114 yes
115 wait
116 messages
117 @output
118 quit
119 END_OF_DATA
120 scripts/check_for_zombie_jobs storage=DDS-4
121 rm -f  ${cwd}/build/src/lib/dummy
122 bin/bacula stop 2>&1 >/dev/null
123 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
124 bstat=$?
125 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
126 rstat=$?
127 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
128 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
129    echo " "
130    echo " "
131    echo "  !!!!! bscan-tape Bacula source failed!!! !!!!! "
132    echo "  !!!!! bscan-tape failed!!! !!!!! " >>test.out
133    echo " "
134 else
135    echo "  ===== bscan-tape Bacula source OK ===== "
136    echo "  ===== bscan-tape OK ===== " >>test.out
137 #  scripts/cleanup
138 fi