#!/bin/sh
#
# Run a backup of the Bacula build directory on two Volumes
-# then migrate it to another device.
+# then copy it to another device.
#
# This script uses the virtual disk autochanger and migration scripts
#
# Write out bconsole commands
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@output
+@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
label storage=File volume=FileVolume001 Pool=Default
yes
wait
messages
-@output
quit
END_OF_DATA
stop_bacula
-################################################################
-# Get information from logs
-get_info()
-{
- IDX=$1
- LOG=$2
- RET=`awk -v idx=$IDX -F: '/Prev Backup JobId/ { pbid[j++]=$2 } /New Backup JobId/ { nbid[i++]=$2 } END { print pbid[idx] " " nbid[idx] }' $LOG`
-}
+get_mig_info 1 ${cwd}/tmp/log11.out
-get_info 0 ${cwd}/tmp/log11.out
-set $RET
-
-if [ -z "$2" -o "$2" = 0 ]; then
+if [ -z "$RET" -o "$RET" = 0 ]; then
bstat=2
print_debug "The first job must have been copied"
fi
-get_info 1 ${cwd}/tmp/log11.out
-set $RET
+get_mig_info 2 ${cwd}/tmp/log11.out
-if [ -z "$2" -o "$2" != 0 ]; then
+if [ -n "$RET" ]; then
bstat=2
- print_debug "The second job have no files, it can't have been copied"
+ print_debug "The second job has no files, it can't have been copied"
fi
-get_info 0 ${cwd}/tmp/log4.out
-set $RET
+JOBID=`awk -F= '/Job queued. JobId/ {if(!f){print $2; f=1;}}' ${cwd}/tmp/log4.out`
+get_mig_info $JOBID ${cwd}/tmp/log4.out
-if [ -z "$2" -o "$2" = 0 ]; then
+if [ -z "$RET" -o "$RET" = 0 ]; then
bstat=2
print_debug "The new incremental job must have been copied"
fi
-
-
check_two_logs
end_test