#!/bin/sh # # Run a simple backup of the Bacula build directory # to a tape where the maximum tape file size is set to 1M # then restore a few files from it. Note, by setting the maximum # file size to 1M, it runs very slow. There are about 64 files that # are created during each of the two backups. # cwd=`pwd` scripts/copy-tape-confs scripts/cleanup-tape echo "${cwd}/build" >/tmp/file-list sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf echo " " echo " " echo " === Starting restore-by-file-tape test `date +%R:%S` ===" echo " === Starting restore-by-file-tape test `date +%R:%S` ===" >>working/log echo " " bin/bacula start 2>&1 >/dev/null bin/bconsole -c bin/bconsole.conf <&1 >/dev/null bin/bacula start 2>&1 >/dev/null for i in `cat ${cwd}/tmp/restore2-list`; do diff $i ${cwd}/tmp/bacula-restores$i if [ $? != 0 ] ; then dstat=1 fi done grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null bstat=$? grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null rstat=$? if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then echo " " echo " " echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! " echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out echo " " bin/bacula stop 2>&1 >/dev/null exit 1 else echo " First of two restores OK " fi rm -rf ${cwd}/tmp/bacula-restores # # Now do a second backup and restore # bin/bconsole -c bin/bconsole.conf <&1 >/dev/null for i in `cat ${cwd}/tmp/restore2-list`; do diff $i ${cwd}/tmp/bacula-restores$i if [ $? != 0 ] ; then dstat=1 fi done grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null bstat=$? grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null rstat=$? if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then echo " " echo " " echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! " echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out echo " " else echo " ===== restore-by-file-tape test Bacula source OK ===== " echo " ===== restore-by-file-tape test OK ===== " >>test.out # scripts/cleanup fi