]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-bacula-tape
Flush changes
[bacula/bacula] / regress / tests / backup-bacula-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #   to a tape then restore it, we do that twice to ensure that
5 #   we can correctly append to a tape.
6 #
7 cwd=`pwd`
8 bin/bacula stop  2>&1 >/dev/null
9 scripts/copy-tape-confs
10 scripts/cleanup-tape
11 echo "${cwd}/build" >/tmp/file-list
12 cd bin
13 ./drop_bacula_tables >/dev/null 2>&1
14 ./make_bacula_tables >/dev/null 2>&1
15 ./grant_bacula_privileges 2>&1 >/dev/null
16 cd ..
17
18 echo " "
19 echo " "
20 echo " === Starting Bacula tape test ==="
21 echo " === Starting Bacula tape test ===" >>working/log
22 echo " "
23
24 bin/bacula start 2>&1 >/dev/null
25 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
26 @output /dev/null
27 messages
28 @output tmp/log1.out
29 label storage=DDS-4 volume=TestVolume001 slot=0
30 run job=NightlySave yes
31 wait
32 messages
33 @# 
34 @# now do a restore
35 @#
36 @output tmp/log2.out
37 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
38 yes
39 wait
40 messages
41 @#
42 @# Now do a second backup
43 @#
44 @output /dev/null
45 messages
46 @output tmp/log1.out
47 label storage=DDS-4 volume=TestVolume001 slot=0
48 run job=NightlySave yes
49 wait
50 messages
51 @# 
52 @# now do a second restore
53 @#
54 @output tmp/log2.out
55 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
56 yes
57 wait
58 messages
59 @output
60 quit
61 END_OF_DATA
62 scripts/check_for_zombie_jobs storage=DDS-4
63 bin/bacula stop 2>&1 >/dev/null
64 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
65 bstat=$?
66 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
67 rstat=$?
68 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
69 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
70    echo " "
71    echo " "
72    echo "  !!!!! Bacula tape test Bacula source failed!!! !!!!! "
73    echo "  !!!!! Bacula tape test failed!!! !!!!! " >>test.out
74    echo " "
75 else
76    echo "  ===== Bacula tape test Bacula source OK ===== "
77    echo "  ===== Bacula tape test OK ===== " >>test.out
78    scripts/cleanup
79 fi