1#!/bin/sh 2# 3# Set prefer mounted volumes to no to try to force use of 4# the drive swap code. 5# 6# This script uses the virtual disk autochanger and two drives 7# 8TestName="2drive-2job" 9JobName="2drive2job" 10 11. scripts/functions 12 13# Directory to backup. 14# This directory will be created by setup_data(). 15BackupDirectory="${tmp}/data" 16 17scripts/cleanup 18 19# Use a tgz to setup data to be backuped. 20# Data will be placed at "${tmp}/data/". 21setup_data data/small.tgz 22 23scripts/copy-2disk-drive-confs 24scripts/prepare-disk-changer 25CLIENT=2drive2disk 26 27change_jobname NightlySave $JobName 28start_test 29 30# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 31echo "${BackupDirectory}" >${tmp}/file-list 32 33# Turn off Prefer Mounted Volumes so we use 2 drives 34outf="${cwd}/tmp/sed_tmp" 35echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf} 36cp ${cwd}/bin/bareos-dir.conf ${cwd}/tmp/1 37# Comment the next line out to write everything to one drive 38# otherwise, it writes the two jobs to different drives 39sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-dir.conf 40 41# Write out bconsole commands 42cat <<END_OF_DATA >${cwd}/tmp/bconcmds 43@$out /dev/null 44messages 45@$out ${cwd}/tmp/log1.out 46label storage=tape volume=TestVolume001 slot=2 Pool=Default drive=0 47label storage=tape volume=TestVolume002 slot=1 Pool=Default drive=1 48status storage=tape 49@#unmount storage=tape drive=0 50@#unmount storage=tape drive=1 51@#mount storage=tape slot=2 drive=0 52@#mount storage=tape slot=1 drive=1 53status storage=tape 54setdebug level=120 storage=tape 55run job=$JobName level=Full yes 56@sleep 2 57run job=$JobName level=Full yes 58status storage=tape 59wait 60list volumes 61list jobs 62status storage=tape 63messages 64quit 65END_OF_DATA 66 67run_bareos 68 69cat <<END_OF_DATA >${cwd}/tmp/bconcmds 70@$out /dev/null 71messages 72@# now do a restore 73@# 74@$out ${cwd}/tmp/log2.out 75@#unmount storage=tape drive=0 76@#unmount storage=tape drive=1 77@#mount storage=tape slot=1 drive=0 78@#mount storage=tape slot=2 drive=1 79restore where=${cwd}/tmp/bareos-restores select all storage=tape done 80yes 81wait 82messages 83quit 84END_OF_DATA 85 86run_bconsole 87check_for_zombie_jobs storage=tape 88stop_bareos 89 90check_two_logs 91check_restore_diff 92 93end_test 94