1#!/bin/sh
2#
3# This script is used to test multiple devices grouped in
4# the director configuration
5#
6#
7TestName="multi-drive-group-test"
8JobName=backup
9. scripts/functions
10
11scripts/cleanup
12scripts/copy-2disk-confs
13scripts/prepare-disk-changer
14
15echo "s/signature=MD5/signature=MD5; readfifo=yes/" > $tmp/1
16echo "s/FileStorage/FileStorage; Device=FileStorage2; Device=FileStorage3; Device=FileStorage4/" >> $tmp/1
17sed -f $tmp/1 $conf/bareos-dir.conf > $tmp/2
18# Allow auto label
19$bperl -e 'add_attribute("$tmp/2", "Label Format", "Vol", "Pool", "Default")'
20$bperl -e 'add_attribute("$tmp/2", "Action On Purge", "Truncate", "Pool", "Default")'
21$bperl -e 'add_attribute("$tmp/2", "Label Format", "Vol", "Pool", "Inc")'
22$bperl -e 'add_attribute("$conf/bareos-sd.conf", "Label Media", "yes", "Device")'
23
24# set this to do round robbin
25#$bperl -e 'set_maximum_concurrent_jobs("$conf/bareos-sd.conf", 1, "Device")'
26
27$bperl -e 'add_attribute("$tmp/2", "Prefer Mounted Volumes", "no", "Job")';
28
29# Disable spooling for each job
30$bperl -e 'add_attribute("$tmp/2", "SpoolData",    "no",  "Job")'
31cp $tmp/2 $conf/bareos-dir.conf
32
33$bperl -e 'extract_resource("$conf/bareos-sd.conf", "Device", "FileStorage")' > $tmp/2
34for i in 2 3 4; do
35    sed "s/FileStorage/FileStorage$i/" $tmp/2 >> $conf/bareos-sd.conf
36done
37
38disable_plugins
39
40
41# Directory to backup.
42# This directory will be created by setup_data().
43BackupDirectory="${tmp}/data"
44
45# Use a tgz to setup data to be backuped.
46# Data will be placed at "${tmp}/data/".
47setup_data data/small.tgz
48
49# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
50echo "${BackupDirectory}" >${tmp}/file-list
51
52
53echo "$tmp/fifo" >>${cwd}/tmp/file-list
54
55mkfifo $tmp/fifo
56(sleep 15 > $tmp/fifo
57 sleep 3 > $tmp/fifo
58)&
59
60change_jobname $JobName
61start_test
62
63# test with autolabel
64#
65#
66# Write out bconsole commands
67cat <<END_OF_DATA >${cwd}/tmp/bconcmds
68@out /dev/null
69messages
70@$out ${cwd}/tmp/log1.out
71run level=full job=backup storage=File pool=Default yes
72run level=full job=backup storage=File pool=Default yes
73run level=full job=backup storage=File pool=Default yes
74run level=full job=backup storage=File pool=Inc yes
75run level=full job=backup storage=File pool=Inc yes
76run level=full job=backup storage=File pool=Default yes
77run level=full job=backup storage=File pool=Default yes
78run level=full job=backup storage=File pool=Default yes
79run level=full job=backup storage=File pool=Default yes
80@sleep 3
81messages
82status storage=File
83status dir
84messages
85wait
86messages
87quit
88END_OF_DATA
89
90run_bareos
91
92check_for_zombie_jobs storage=File
93check_for_zombie_jobs storage=tape
94stop_bareos
95
96touch $tmp/log2.out
97check_two_logs
98#check_restore_diff
99
100end_test
101