]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-volume-tape
Fix script
[bacula/bacula] / regress / tests / two-volume-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #   to two tapes where the maximum tape file size is set to 1M
5 #
6 cwd=`pwd`
7 bin/bacula stop  2>&1 >/dev/null
8 scripts/copy-tape-confs
9 mtx -f /dev/sg0 unload
10 mtx -f /dev/sg0 load 1
11 mt -f /dev/nst0 rewind
12 mt -f /dev/nst0 weof
13 mtx -f /dev/sg0 unload
14 mtx -f /dev/sg0 load 2
15 mt -f /dev/nst0 rewind
16 mt -f /dev/nst0 weof
17 mtx -f /dev/sg0 unload
18 echo "${cwd}/build" >/tmp/file-list
19 bin/drop_sqlite_tables
20 bin/make_sqlite_tables
21 out="/tmp/sed_tmp"
22 echo "s%# Maximum File Size%  Maximum File Size%g" >${out}
23 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
24 sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
25
26 echo " "
27 echo " "
28 echo " === Starting Two Volume Tape test ==="
29 echo " === Starting Two Volume Tape test ===" >>working/log
30 echo " "
31
32 bin/bacula start 2>&1 >/dev/null
33 bin/console -c bin/console.conf <<END_OF_DATA
34 @output /dev/null
35 messages
36 @output tmp/log1.out
37 label storage=DDS-4 volume=TestVolume001 slot=1
38 label storage=DDS-4 volume=TestVolume002 slot=2
39 update Volume=TestVolume001 MaxVolBytes=3000000
40 run job=NightlySave yes
41 wait
42 messages
43 @# 
44 @# now do a restore
45 @#
46 @output tmp/log2.out
47 restore current all
48 yes
49 wait
50 messages
51 @output
52 quit
53 END_OF_DATA
54 bin/bacula stop 2>&1 >/dev/null
55 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
56 bstat=$?
57 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
58 rstat=$?
59 diff -r build /tmp/bacula-restores${cwd}/build
60 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
61    echo " "
62    echo " "
63    echo "  !!!!! Two Volume Tape test Bacula source failed!!! !!!!! "
64    echo "  !!!!! Two Volume Tape test failed!!! !!!!! " >>test.out
65    echo " "
66 else
67    echo "  ===== Two Volume Tape test Bacula source OK ===== "
68    echo "  ===== Two Volume Tape test OK ===== " >>test.out
69 #  scripts/cleanup
70 fi