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