1#!/bin/sh 2# 3# This script uses the virtual disk autochanger 4# 5TestName="multi-storage-test" 6JobName=backup 7. scripts/functions 8 9scripts/cleanup 10scripts/copy-2disk-confs 11scripts/prepare-disk-changer 12 13# create a new bareos-sd.conf 14BAREOS_SD2_CONF=$conf/bareos-sd2.conf 15BAREOS_SD2_PORT="1${BAREOS_SD_PORT}" 16perl -ne ' 17if (/SDPort = /) { $_ =~ s/(\d+)/1$1/;} 18if (/Name = .+?-sd/) { $_ =~ s/-sd/-sd2/;} 19if (/WorkingDirectory/) { $_ =~ s/"$/\/StorageDaemon2"/; } 20print; 21' $conf/bareos-sd.conf > $BAREOS_SD2_CONF 22 23mkdir -p ${working}/StorageDaemon2 24 25 26perl -ne ' 27if (/^Storage \{/) { $in=1; $nb++; } 28if (/^}/) { $in=0 } 29if (/SDPort = (\d+)/ && $in) {if ($nb == 2) { $_ = " SDPort = 1$1\n"; }} 30print; 31' $conf/bareos-dir.conf > $tmp/1 32cp $tmp/1 $conf/bareos-dir.conf 33change_jobname $JobName 34 35 36disable_plugins 37 38 39# Directory to backup. 40# This directory will be created by setup_data(). 41BackupDirectory="${tmp}/data" 42 43# Use a tgz to setup data to be backed up. 44# Data will be placed at "${tmp}/data/". 45setup_data data/small.tgz 46 47# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 48echo "${BackupDirectory}" >${tmp}/file-list 49 50 51start_test 52 53# Write out bconsole commands 54cat <<END_OF_DATA >${cwd}/tmp/bconcmds 55@$out /dev/null 56messages 57@$out ${cwd}/tmp/log1.out 58label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0 59label storage=File volume=TestVolume002 Pool=Default 60run job=$JobName storage=tape yes 61wait 62messages 63quit 64END_OF_DATA 65 66 67BAREOS_CONFIG_DIR=$BAREOS_SD2_CONF BAREOS_SD_PORT=$BAREOS_SD2_PORT $scripts/bareos-ctl-sd start 68run_bareos 69 70echo "ficheriro1.txt" >${BackupDirectory}/ficheriro1.txt 71echo "ficheriro2.txt" >${BackupDirectory}/ficheriro2.txt 72 73 74cat <<END_OF_DATA >${cwd}/tmp/bconcmds 75@$out /dev/null 76messages 77@$out ${cwd}/tmp/log1.out 78@# Force Incremental on the second Volume 79run level=Incremental storage=File job=$JobName yes 80wait 81messages 82@# 83@# now do a restore 84@# 85@$out ${cwd}/tmp/log2.out 86setdebug trace=1 level=110 client 87setdebug trace=1 level=110 director 88restore where=${cwd}/tmp/bareos-restores select all done yes 89wait 90messages 91quit 92END_OF_DATA 93 94run_bconsole 95 96check_for_zombie_jobs storage=File 97check_for_zombie_jobs storage=tape 98stop_bareos 99BAREOS_CONFIG_DIR=$BAREOS_SD2_CONF BAREOS_SD_PORT=$BAREOS_SD2_PORT $scripts/bareos-ctl-sd stop 100 101check_two_logs 102check_restore_diff 103 104end_test 105