]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-tape
Doc updates
[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 scripts/check_for_zombie_jobs storage=DDS-4
40 echo "Backup 1 done"
41 # make some files for the incremental to pick up
42 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
43 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
44    
45 #
46 # run a second job
47 #
48 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
49 @output /dev/null
50 messages
51 @output tmp/log1.out
52 run job=NightlySave level=Incremental yes
53 wait
54 messages
55 quit
56 END_OF_DATA
57 scripts/check_for_zombie_jobs storage=DDS-4
58 echo "Backup 2 done"
59 touch ${cwd}/build/src/dird/*.c
60 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
61 #
62 # run a third job
63 #
64 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
65 @output /dev/null
66 messages
67 @output tmp/log1.out
68 run job=NightlySave level=Incremental yes
69 wait
70 messages
71 quit
72 END_OF_DATA
73 scripts/check_for_zombie_jobs storage=DDS-4
74 echo "Backup 3 done"
75 # make some files for the incremental to pick up
76 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
77 #
78 # run a fourth job
79 #
80 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
81 @output /dev/null
82 messages
83 @output tmp/log1.out
84 run job=NightlySave level=Incremental yes
85 wait
86 messages
87 quit
88 END_OF_DATA
89 scripts/check_for_zombie_jobs storage=DDS-4
90 echo "Backup 4 done"
91
92 # now do several restores to ensure we cleanup between jobs
93 #
94 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
95 @output /dev/null
96 restore where=${cwd}/tmp/bacula-restores select all done
97 yes
98 wait
99 restore where=${cwd}/tmp/bacula-restores select all done
100 yes
101 wait
102 @output tmp/log2.out
103 restore where=${cwd}/tmp/bacula-restores select
104 unmark *
105 mark *
106 done
107 yes
108 wait
109 messages
110 @output
111 quit
112 END_OF_DATA
113 bin/bacula stop 2>&1 >/dev/null
114 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
115 bstat=$?
116 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
117 rstat=$?
118 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
119 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
120    echo " "
121    echo " "
122    echo "  !!!!! four-jobs-tape Bacula source failed!!! !!!!! "
123    echo "  !!!!! four-jobs-tape failed!!! !!!!! " >>test.out
124    echo " "
125 else
126    echo "  ===== four-jobs-tape Bacula source OK ===== "
127    echo "  ===== four-jobs-tape OK ===== " >>test.out
128    scripts/cleanup
129 fi