]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-tape
replace references to sqlite scripts with generic bacula scripts.
[bacula/bacula] / regress / tests / four-jobs-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 finally restore.
5 #   It should require at least 4 different bsrs.
6 #
7 cwd=`pwd`
8 bin/bacula stop 2>&1 >/dev/null
9 cd bin
10 ./drop_bacula_tables >/dev/null 2>&1
11 ./make_bacula_tables >/dev/null 2>&1
12 ./grant_bacula_privileges 2>&1 >/dev/null
13 cd ..
14
15 scripts/copy-tape-confs
16 scripts/cleanup-tape
17 echo "${cwd}/build" >/tmp/file-list
18
19 echo " "
20 echo " "
21 echo " === Starting four-jobs-tape  ==="
22 echo " === Starting four-jobs-tape  ===" >>working/log
23 echo " "
24
25 bin/bacula start 2>&1 >/dev/null
26 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
27 @output /dev/null
28 estimate job=NightlySave listing
29 estimate job=NightlySave listing
30 estimate job=NightlySave listing
31 messages
32 @output tmp/log1.out
33 label storage=DDS-4 volume=TestVolume001 slot=0
34 run job=NightlySave yes
35 wait
36 messages
37 quit
38 END_OF_DATA
39 echo "Backup 1 done"
40 # make some files for the incremental to pick up
41 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
42 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
43    
44 #
45 # run a second job
46 #
47 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
48 @output /dev/null
49 messages
50 @output tmp/log1.out
51 run job=NightlySave level=Incremental yes
52 wait
53 messages
54 quit
55 END_OF_DATA
56 echo "Backup 2 done"
57 touch ${cwd}/build/src/dird/*.c
58 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
59 #
60 # run a third job
61 #
62 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
63 @output /dev/null
64 messages
65 @output tmp/log1.out
66 run job=NightlySave level=Incremental yes
67 wait
68 messages
69 quit
70 END_OF_DATA
71 echo "Backup 3 done"
72 # make some files for the incremental to pick up
73 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
74 #
75 # run a fourth job
76 #
77 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
78 @output /dev/null
79 messages
80 @output tmp/log1.out
81 run job=NightlySave level=Incremental yes
82 wait
83 messages
84 quit
85 END_OF_DATA
86 echo "Backup 4 done"
87
88 # now do several restores to ensure we cleanup between jobs
89 #
90 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
91 @output /dev/null
92 restore where=${cwd}/tmp/bacula-restores select all
93 yes
94 wait
95 restore where=${cwd}/tmp/bacula-restores select all
96 yes
97 wait
98 @output tmp/log2.out
99 restore where=${cwd}/tmp/bacula-restores select all
100 yes
101 wait
102 messages
103 @output
104 quit
105 END_OF_DATA
106 bin/bacula stop 2>&1 >/dev/null
107 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
108 bstat=$?
109 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
110 rstat=$?
111 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
112 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
113    echo " "
114    echo " "
115    echo "  !!!!! four-jobs-tape Bacula source failed!!! !!!!! "
116    echo "  !!!!! four-jobs-tape failed!!! !!!!! " >>test.out
117    echo " "
118 else
119    echo "  ===== four-jobs-tape Bacula source OK ===== "
120    echo "  ===== four-jobs-tape OK ===== " >>test.out
121    scripts/cleanup
122 fi