#!/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.
#
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
+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
# Write out bconsole commands
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@output
+@output /dev/null
messages
@$out ${cwd}/tmp/log1.out
-setdebug level=100 storage=File
+@# 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
+@#purge volume=FileVolume001
list jobs
list volumes
wait
@#
@$out ${cwd}/tmp/log2.out
list volumes
-restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
+@#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
list volumes
wait
messages
-@output
quit
END_OF_DATA