]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore2-by-file-test
Update smtp to bsmtp and console to bconsole
[bacula/bacula] / regress / tests / restore2-by-file-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then restore a few selected files.
5 #
6 cwd=`pwd`
7 scripts/copy-test-confs
8 scripts/cleanup
9 echo "${cwd}/build" >/tmp/file-list
10 sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
11 bin/bacula stop  2>&1 >/dev/null
12 bin/drop_sqlite_tables
13 bin/make_sqlite_tables
14
15 echo " "
16 echo " "
17 echo " === Starting restore2-by-file-test ==="
18 echo " === Starting restore2-by-file-test ===" >>working/log
19 echo " "
20
21 bin/bacula start 2>&1 >/dev/null
22 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
23 @output /dev/null
24 messages
25 @output tmp/log1.out
26 label storage=File volume=TestVolume001
27 run job=CompressedTest yes
28 wait
29 messages
30 @# 
31 @# now do a restore
32 @#
33 @output tmp/log2.out
34 restore where=${cwd}/tmp/bacula-restores
35 7
36 <${cwd}/tmp/restore2-list
37
38 yes
39 wait
40 messages
41 @output
42 quit
43 END_OF_DATA
44 bin/bacula stop 2>&1 >/dev/null
45 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
46 bstat=$?
47 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
48 rstat=$?
49 dstat=0
50 for i in `cat ${cwd}/tmp/restore2-list`; do  
51    diff $i ${cwd}/tmp/bacula-restores$i
52    if [ $? != 0 ] ; then
53       dstat=1
54    fi
55 done
56 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
57    echo " "
58    echo " "
59    echo "  !!!!! restore2-by-file-test Bacula source failed!!! !!!!! "
60    echo "  !!!!! restore2-by-file-test failed!!! !!!!! " >>test.out
61    echo " "
62    echo "Backup term status  = $bstat"
63    echo "Restore term status = $rstat"
64    echo "Diff status         = $dstat"
65    echo " "
66 else
67    echo "  ===== restore2-by-file-test Bacula source OK ===== "
68    echo "  ===== restore2-by-file-test OK ===== " >>test.out
69    scripts/cleanup
70 fi