#!/bin/sh # # Run a simple backup of the Bacula build directory # to a tape then restore it, we do that twice to ensure that # we can correctly append to a tape. # We also use the purge and the relabel commands as # well as a pile of status storage commands. # debug=0 if test "$debug" -eq 1 ; then out="tee" else out="output" fi cwd=`pwd` scripts/copy-tape-confs scripts/cleanup-tape echo "${cwd}/build" >/tmp/file-list echo " " echo " " echo " === Starting Backup Bacula tape test at `date +%R:%S` ===" echo " === Starting Backup Bacula tape test at `date +%R:%S` ===" >>working/log echo " " # Write out bconsole commands cat <tmp/bconcmds @output /dev/null messages @$out tmp/log1.out label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default purge volume=TestVolume001 relabel pool=Default storage=DDS-4 oldVolume=TestVolume001 volume=TestVolume002 slot=0 purge volume=TestVolume002 relabel pool=Default storage=DDS-4 oldVolume=TestVolume002 volume=TestVolume001 slot=0 run job=NightlySave yes status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 @sleep 1 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 @sleep 1 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 @sleep 1 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 @sleep 1 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 status storage=DDS-4 wait messages @# @# now do a restore @# @$out tmp/log2.out restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done yes wait list volumes messages END_OF_DATA if test "$debug" -eq 1 ; then bin/bacula start cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf else bin/bacula start 2>&1 >/dev/null cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null fi bin/bacula stop 2>&1 >/dev/null # # Now do a second backup after making a few changes # touch ${cwd}/build/src/dird/*.c echo "test test" > ${cwd}/build/src/dird/xxx cat <tmp/bconcmds @$out /dev/null messages @$out tmp/log1.out list volumes run job=NightlySave yes wait list volumes messages @# @# now do a second restore @# @$out tmp/log2.out list volumes restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done yes wait list volumes messages @$out quit END_OF_DATA if test "$debug" -eq 1 ; then bin/bacula start cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf else bin/bacula start 2>&1 >/dev/null cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null fi scripts/check_for_zombie_jobs storage=DDS-4 bin/bacula stop 2>&1 >/dev/null grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null bstat=$? grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null rstat=$? diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then echo " " echo " " echo " !!!!! Backup Bacula tape test failed!!! !!!!! " echo " !!!!! Backup Bacula tape test failed!!! !!!!! " >>test.out echo " " else echo " ===== Backup Bacula tape test OK ===== " echo " ===== Backup Bacula tape test OK ===== " >>test.out scripts/cleanup fi