/
bextract-test
executable file
·63 lines (55 loc) · 1.49 KB
/
bextract-test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
#
# Run a simple backup but
# split the archive into two volumes, then build a BSR with
# the restore command and use bextract to restore the files.
#
TestName="bextract-test"
JobName="bextract"
. scripts/functions
scripts/cleanup
scripts/copy-test-confs
change_jobname NightlySave $JobName
# Directory to backup.
# This directory will be created by setup_data().
BackupDirectory="${tmp}/data"
# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data data/small.tgz
start_test
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
label storage=File1 volume=TestVolume001 pool=Default
label storage=File1 volume=TestVolume002 pool=Default
update Volume=TestVolume001 MaxVolBytes=10000
@#setdebug level=400 dir
setdebug level=400 storage=File1
run job=$JobName storage=File1 yes
wait
messages
@#
@# now build the bsr file but do not restore
@#
@$out ${tmp}/log2.out
restore bootstrap=${working}/restore.bsr where=${tmp}/bareos-restores select all storage=File1 done
no
wait
messages
quit
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=File1
stop_bareos
mkdir -p ${cwd}/tmp/bareos-restores
if test "$debug" -eq 1 ; then
$bin/bextract -v -c ${conf} -b ${working}/restore.bsr ${tmp} ${tmp}/bareos-restores
else
$bin/bextract -c ${conf} -b ${working}/restore.bsr ${tmp} ${tmp}/bareos-restores 2>&1 >/dev/null
fi
rstat=$?
grep "^ Termination: *Backup OK" ${tmp}/log1.out 2>&1 >/dev/null
bstat=$?
check_restore_diff
end_test