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