]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-bacula-tape
bb485eb25817b904d82cc3fc287dd82f7da11a44
[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 scripts/copy-tape-confs
9 scripts/cleanup-tape
10
11 echo "${cwd}/build" >/tmp/file-list
12
13 echo " "
14 echo " "
15 echo " === Starting Bacula tape test ==="
16 echo " === Starting Bacula tape test ===" >>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 messages
23 @output tmp/log1.out
24 label storage=DDS-4 volume=TestVolume001 slot=0
25 run job=NightlySave yes
26 status storage=DDS-4
27 status storage=DDS-4
28 status storage=DDS-4
29 status storage=DDS-4
30 status storage=DDS-4
31 status storage=DDS-4
32 sleep 1
33 status storage=DDS-4
34 status storage=DDS-4
35 status storage=DDS-4
36 status storage=DDS-4
37 status storage=DDS-4
38 wait
39 messages
40 @# 
41 @# now do a restore
42 @#
43 @output tmp/log2.out
44 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
45 yes
46 wait
47 messages
48 END_OF_DATA
49 bin/bacula stop 2>&1 >/dev/null
50 #
51 # Now do a second backup after making a few changes
52 #
53 touch ${cwd}/build/src/dird/*.c
54 echo "test test" > ${cwd}/build/src/dird/xxx
55 bin/bacula start 2>&1 >/dev/null
56 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
57 @output /dev/null
58 messages
59 @output tmp/log1.out
60 run job=NightlySave yes
61 wait
62 messages
63 @# 
64 @# now do a second restore
65 @#
66 @output tmp/log2.out
67 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
68 yes
69 wait
70 messages
71 @output
72 quit
73 END_OF_DATA
74 scripts/check_for_zombie_jobs storage=DDS-4
75
76 bin/bacula stop 2>&1 >/dev/null
77 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
78 bstat=$?
79 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
80 rstat=$?
81 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
82 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
83    echo " "
84    echo " "
85    echo "  !!!!! Bacula tape test Bacula source failed!!! !!!!! "
86    echo "  !!!!! Bacula tape test failed!!! !!!!! " >>test.out
87    echo " "
88 else
89    echo "  ===== Bacula tape test Bacula source OK ===== "
90    echo "  ===== Bacula tape test OK ===== " >>test.out
91    scripts/cleanup
92 fi