]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore2-by-file-test
Updates
[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
12 echo " "
13 echo " "
14 echo " === Starting restore2-by-file-test at `date +%R:%S` ==="
15 echo " === Starting restore2-by-file-test at `date +%R:%S` ===" >>working/log
16 echo " "
17
18 bin/bacula start 2>&1 >/dev/null
19 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
20 @output /dev/null
21 messages
22 @output tmp/log1.out
23 label storage=File volume=TestVolume001
24 run job=CompressedTest yes
25 wait
26 messages
27 @# 
28 @# now do a restore
29 @#
30 @output tmp/log2.out
31 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore2-list
32 yes
33 wait
34 messages
35 @output
36 quit
37 END_OF_DATA
38 scripts/check_for_zombie_jobs storage=File
39 bin/bacula stop 2>&1 >/dev/null
40 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
41 bstat=$?
42 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
43 rstat=$?
44 dstat=0
45 for i in `cat ${cwd}/tmp/restore2-list`; do  
46    diff $i ${cwd}/tmp/bacula-restores$i
47    if [ $? != 0 ] ; then
48       dstat=1
49    fi
50 done
51 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
52    echo " "
53    echo " "
54    echo "  !!!!! restore2-by-file-test Bacula source failed!!! !!!!! "
55    echo "  !!!!! restore2-by-file-test failed!!! !!!!! " >>test.out
56    echo " "
57    echo "Backup term status  = $bstat"
58    echo "Restore term status = $rstat"
59    echo "Diff status         = $dstat"
60    echo " "
61 else
62    echo "  ===== restore2-by-file-test Bacula source OK ===== "
63    echo "  ===== restore2-by-file-test OK ===== " >>test.out
64    scripts/cleanup
65 fi