This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
/
backup-bareos-passive-test
executable file
·113 lines (98 loc) · 2.04 KB
/
backup-bareos-passive-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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
#
# Run a simple backup of the Bareos build directory
# then restore it.
#
TestName="backup-bareos-passive-test"
JobName=backup
. scripts/functions
scripts/cleanup
scripts/copy-confs
#
# Zap out any schedule in default conf file so that
# it doesn't start during our test
#
outf="$tmp/sed_tmp"
echo "s% Schedule =%# Schedule =%g" >${outf}
cp $scripts/bareos-dir.conf $tmp/1
sed -f ${outf} $tmp/1 >$scripts/bareos-dir.conf
# set passive to yes:
cp $scripts/bareos-dir.conf $tmp/1
echo 's#^Client {#Client { \n passive = yes \n#g' >${outf}
sed -f ${outf} $tmp/1 >$scripts/bareos-dir.conf
# set compatible to no in fd.conf
cp $scripts/bareos-fd.conf $tmp/1
echo 's#^FileDaemon {#FileDaemon { \n compatible = no \n#g' >${outf}
sed -f ${outf} $tmp/1 >$scripts/bareos-fd.conf
change_jobname BackupClient1 $JobName
start_test
cat <<END_OF_DATA >$tmp/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
setdebug level=100 storage=File
label volume=TestVolume001 storage=File pool=File
run job=$JobName yes
status storage=File
status storage=File
status storage=File
status storage=File
status storage=File
status storage=File
@sleep 1
status storage=File
status storage=File
status storage=File
status storage=File
status storage=File
@sleep 1
status storage=File
status storage=File
status storage=File
status storage=File
status storage=File
wait
messages
@#
@# now do a restore
@#
@$out $tmp/log2.out
restore where=$tmp/bareos-restores select all done
yes
wait
messages
quit
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=File
stop_bareos
cat <<END_OF_DATA >$tmp/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
@#setdebug level=100 storage=File
run job=$JobName yes
wait
messages
@#
@# now do a restore
@#
@$out $tmp/log2.out
restore where=$tmp/bareos-restores select all done
yes
wait
messages
quit
END_OF_DATA
#
# Now do a second backup after making a few changes
#
touch ${cwd}/build/src/dird/*.c
echo "test test" > ${cwd}/build/src/dird/xxx
#
run_bareos
check_for_zombie_jobs storage=File
stop_bareos
check_two_logs
check_restore_diff
end_test