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