]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-bacula-tape
Final 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 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 wait
27 messages
28 @# 
29 @# now do a restore
30 @#
31 @output tmp/log2.out
32 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
33 yes
34 wait
35 messages
36 END_OF_DATA
37 bin/bacula stop 2>&1 >/dev/null
38 #
39 # Now do a second backup after making a few changes
40 #
41 touch ${cwd}/build/src/dird/*.c
42 echo "test test" > ${cwd}/build/src/dird/xxx
43 bin/bacula start 2>&1 >/dev/null
44 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
45 @output /dev/null
46 messages
47 @output tmp/log1.out
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
64 bin/bacula stop 2>&1 >/dev/null
65 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
66 bstat=$?
67 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
68 rstat=$?
69 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
70 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
71    echo " "
72    echo " "
73    echo "  !!!!! Bacula tape test Bacula source failed!!! !!!!! "
74    echo "  !!!!! Bacula tape test failed!!! !!!!! " >>test.out
75    echo " "
76 else
77    echo "  ===== Bacula tape test Bacula source OK ===== "
78    echo "  ===== Bacula tape test OK ===== " >>test.out
79    scripts/cleanup
80 fi