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