1#!/bin/sh 2# 3# Run a simple backup then copy it 4# to another device. 5# 6# This script uses the virtual disk autochanger 7# 8TestName="copy-job-test" 9JobName=CopyJobSave 10. scripts/functions 11 12 13scripts/cleanup 14scripts/copy-migration-confs 15scripts/prepare-disk-changer 16sed 's/migrate/copy/g' ${cwd}/bin/bareos-dir.conf > ${cwd}/tmp/1 17sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bareos-dir.conf 18change_jobname NightlySave $JobName 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 29start_test 30 31# 32# Note, we first backup into Pool Default, 33# then Copy into Pool Full. 34# Pool Default uses Storage=File 35# Pool Full uses Storage=DiskChanger 36 37# Write out bconsole commands 38cat <<END_OF_DATA >${cwd}/tmp/bconcmds 39@$out /dev/null 40messages 41@$out ${cwd}/tmp/log1.out 42@# setdebug level=100 storage=File 43label storage=File volume=FileVolume001 Pool=Default 44label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 45label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 46@# run two jobs (both will be copied) 47run job=$JobName yes 48run job=$JobName yes 49run job=$JobName yes 50wait 51list jobs 52list volumes 53@#setdebug level=100 dir 54@# should copy two jobs 55@#setdebug level=51 storage=DiskChanger 56run job=copy-job yes 57wait 58messages 59@#purge volume=FileVolume001 60list jobs 61list volumes 62wait 63messages 64@$out ${cwd}/tmp/log3.out 65@# 66@# Now do another backup, but level Incremental 67@# 68run job=$JobName level=Incremental yes 69wait 70messages 71@# 72@# This final job that runs should be Incremental and 73@# not upgraded to full. 74list jobs 75@# 76@# now do a restore 77@# 78@$out ${cwd}/tmp/log2.out 79list volumes 80restore where=${cwd}/tmp/bareos-restores select 81unmark * 82mark * 83done 84yes 85list volumes 86wait 87messages 88quit 89END_OF_DATA 90 91run_bareos 92check_for_zombie_jobs storage=File 93stop_bareos 94 95check_two_logs 96check_restore_diff 97 98grep 'Backup Level:' tmp/log3.out | grep Incremental > /dev/null 99if [ $? != 0 ]; then 100 bstat=2 101 print_debug "The incremental job must use copied jobs" 102fi 103 104end_test 105