#!/bin/sh # # Run a simple backup of the Bacula build directory then copy it # to another device. # # This script uses the virtual disk autochanger # TestName="copy-time-test" JobName=CopyJobSave . scripts/functions scripts/cleanup scripts/copy-migration-confs scripts/prepare-disk-changer echo "${cwd}/build" >${cwd}/tmp/file-list sed -i 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf sed -i 's/Migrate/Copy/g' ${cwd}/bin/bacula-dir.conf change_jobname NightlySave $JobName start_test # # Note, we first backup into Pool Default, # then Copy into Pool Full. # Pool Default uses Storage=File # Pool Full uses Storage=DiskChanger # Write out bconsole commands cat <${cwd}/tmp/bconcmds @output messages @$out ${cwd}/tmp/log1.out label storage=File volume=FileVolume001 Pool=Default label storage=File volume=FileVolume002 Pool=Special label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 list volumes @# run three jobs run job=$JobName Pool=Special level=Full yes run job=$JobName level=Full yes run job=$JobName level=Full yes wait messages update volume=FileVolume001 VolStatus=Used update volume=FileVolume002 VolStatus=Used llist jobid=2,3 list jobs list volumes @#setdebug level=20 dir @# should copy only jobid=2 and 3 run job=copy-time yes run job=copy-time pool=Special yes wait messages wait list jobs list volumes purge volume=FileVolume001 purge volume=FileVolume002 @# @# now do a restore @# @$out ${cwd}/tmp/log2.out restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger unmark * mark * done yes wait messages @output quit END_OF_DATA run_bacula check_for_zombie_jobs storage=File stop_bacula print_debug "We must find 3 copy jobs into the log" for i in 0 1 2; do get_mig_info $i ${cwd}/tmp/log1.out set $RET >/dev/null if [ -n "$1" -a "$1" != 1 ]; then bstat=2 print_debug "The first job should not been copied" fi done check_two_logs check_restore_diff end_test