#!/bin/sh # # Copyright (C) 2000-2017 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Run a simple backup of the Bacula build directory then copy it # to another device. # # This script uses the virtual disk autochanger # TestName="copy-job-test" JobName=CopyJobSave . scripts/functions scripts/cleanup scripts/copy-migration-confs echo "${cwd}/build" >${cwd}/tmp/file-list sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${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 /dev/null messages @$out ${cwd}/tmp/log1.out @# setdebug level=100 storage=File label storage=File volume=FileVolume001 Pool=Default label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 @# run two jobs (both will be copied) run job=$JobName yes run job=$JobName yes run job=$JobName yes wait list jobs list volumes @#setdebug level=100 dir @# should copy two jobs @#setdebug level=51 storage=DiskChanger @#setdebug level=100 storage=File tags=dedup,asx,network options=h run job=copy-job yes wait messages @#purge volume=FileVolume001 list jobs list volumes wait messages @$out ${cwd}/tmp/log3.out @# @# Now do another backup, but level Incremental @# run job=$JobName level=Incremental yes wait messages @# @# This final job that runs should be Incremental and @# not upgraded to full. list jobs @# @# now do a restore @# @$out ${cwd}/tmp/log2.out list volumes @#setdebug level=15 director @#setdebug level=150 storage=DiskChanger @# Note, here we are restoring from the original backup, @# so if you specify storage=DiskChanger the restore will fail restore where=${cwd}/tmp/bacula-restores select unmark * mark * done yes list volumes wait messages quit END_OF_DATA run_bacula check_for_zombie_jobs storage=File stop_bacula check_two_logs check_restore_diff grep 'Backup Level:' tmp/log3.out | grep Incremental > /dev/null if [ $? != 0 ]; then bstat=2 print_debug "The incremental job must use copied jobs" fi end_test