]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-tape
Merge branch 'master' into basejobv3
[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 TestName="bscan-tape"
9 JobName=bscantape
10 . scripts/functions
11
12 require_tape_drive
13
14 copy_tape_confs
15
16 echo "${cwd}/build" >tmp/file-list
17
18 cp ${cwd}/bin/bacula-sd.conf tmp/1
19 sed "s%# Maximum File Size%  Maximum File Size%" tmp/1 >${cwd}/bin/bacula-sd.conf
20
21 change_jobname NightlySave $JobName
22 start_test
23
24 cat <<END_OF_DATA >tmp/bconcmds
25 @$out /dev/null
26 estimate job=$JobName listing
27 estimate job=$JobName listing
28 messages
29 @$out tmp/log1.out
30 setdebug level=2 storage=tape
31 label storage=tape volume=TestVolume001 slot=0 pool=Default
32 run job=$JobName level=Full yes 
33 wait
34 run job=$JobName level=Full yes
35 wait
36 messages
37 quit
38 END_OF_DATA
39
40 run_bacula
41 check_for_zombie_jobs storage=tape
42
43 echo "Backup 1 done"
44 # make some files for the incremental to pick up
45 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
46 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
47    
48 #
49 # run a second job
50 #
51 cat <<END_OF_DATA >tmp/bconcmds
52 @$out /dev/null
53 messages
54 @$out tmp/log1.out
55 run job=$JobName level=Incremental yes
56 wait
57 messages
58 quit
59 END_OF_DATA
60
61 run_bconsole
62 scripts/check_for_zombie_jobs storage=tape
63
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
71 run_bconsole
72 scripts/check_for_zombie_jobs storage=tape
73
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 #echo "abc" > ${cwd}/build/src/lib/dummy
78 #
79 # run a fourth job
80 #
81
82 run_bconsole
83 scripts/check_for_zombie_jobs storage=tape
84
85 stop_bacula
86
87 echo "Backup 4 done"
88 #
89 # now drop and recreate the database
90 #
91 cd bin
92 ./drop_bacula_tables >/dev/null 2>&1
93 ./make_bacula_tables >/dev/null 2>&1
94 ./grant_bacula_privileges 2>&1 >/dev/null
95 cd ..
96
97 echo "volume=TestVolume001" >tmp/bscan.bsr
98
99 bscan_libdbi
100
101 # If the database has a password pass it to bscan
102 if test "x${db_password}" = "x"; then
103   PASSWD=
104 else
105   PASSWD="-P ${db_password}"
106 fi
107
108 if test "$debug" -eq 1 ; then
109   $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf tape                
110 else
111   $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf tape >/dev/null 2>&1
112 fi
113
114 echo $BSCANLIBDBI
115
116 cat <<END_OF_DATA >tmp/bconcmds
117 @$out /dev/null
118 messages
119 @$out tmp/log2.out
120 @# 
121 @# now do a restore
122 @#
123 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
124 yes
125 wait
126 messages
127 quit
128 END_OF_DATA
129
130 run_bacula
131 check_for_zombie_jobs storage=tape
132 stop_bacula
133 rm -f  ${cwd}/build/src/lib/dummy
134
135 check_two_logs
136 check_restore_diff
137 end_test