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