1#!/bin/sh
2#
3# Set Client in Passive mode.
4# Run simple backups and restore them.
5#
6TestName="backup-bareos-passive-test"
7JobName=backup
8. scripts/functions
9
10scripts/cleanup
11scripts/copy-confs
12
13#
14# Zap out any schedule in default conf file so that
15#  it doesn't start during our test
16#
17outf="$tmp/sed_tmp"
18echo "s%  Schedule =%# Schedule =%g" >${outf}
19cp ${conf}/bareos-dir.conf $tmp/1
20sed -f ${outf} $tmp/1 >${conf}/bareos-dir.conf
21
22dircfg=$conf/bareos-dir.conf
23$bperl -e "add_attribute('$dircfg', 'passive', 'Yes', 'Client')"
24
25fdcfg=$conf/bareos-fd.conf
26$bperl -e "add_attribute('$fdcfg', 'Compatible', 'No', 'FileDaemon')"
27
28change_jobname BackupClient1FileList $JobName
29
30# Directory to backup.
31# This directory will be created by setup_data().
32BackupDirectory="${tmp}/data"
33
34# Use a tgz to setup data to be backuped.
35# Data will be placed at "${tmp}/data/".
36setup_data data/small.tgz
37
38# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
39echo "${BackupDirectory}" >${tmp}/file-list
40
41
42start_test
43
44cat <<END_OF_DATA >$tmp/bconcmds
45@$out /dev/null
46messages
47@$out $tmp/log1.out
48setdebug level=100 storage=File
49run job=$JobName yes
50wait
51messages
52@#
53@# now do a restore
54@#
55@$out $tmp/log2.out
56restore where=$tmp/bareos-restores select all done
57yes
58wait
59messages
60quit
61END_OF_DATA
62
63run_bareos
64check_for_zombie_jobs storage=File
65
66#
67# Now do a second backup after making a few changes
68#
69change_files
70
71cat <<END_OF_DATA >$tmp/bconcmds
72@$out /dev/null
73messages
74@$out $tmp/log1.out
75@#setdebug level=100 storage=File
76run job=$JobName yes
77wait
78messages
79@#
80@# now do a restore
81@#
82@$out $tmp/log2.out
83restore where=$tmp/bareos-restores select all done
84yes
85wait
86messages
87quit
88END_OF_DATA
89
90run_bconsole
91check_for_zombie_jobs storage=File
92stop_bareos
93
94check_two_logs
95check_restore_diff
96end_test
97