#!/bin/sh # # Run a simple backup of the Bacula build directory # prune file records, then restore only README files. # TestName="fileregexp-test" JobName=backup . scripts/functions scripts/cleanup scripts/copy-confs # # Zap out any schedule in default conf file so that # it doesn't start during our test # outf="${tmp}/sed_tmp" echo "s% Schedule =%# Schedule =%g" >${outf} echo "s%File Retention =%File Retention = 2 #%" >> ${outf} cp ${scripts}/bacula-dir.conf ${tmp}/1 sed -f ${outf} ${tmp}/1 >${scripts}/bacula-dir.conf change_jobname Client1 $JobName start_test cat <${tmp}/bconcmds @output /dev/null messages @$out ${tmp}/log1.out label volume=TestVolume001 storage=File pool=Default run job=$JobName yes wait messages @sleep 5 prune files yes @# @# now do a restore @# @$out ${tmp}/log2.out restore where=${tmp}/bacula-restores 5 no README yes wait messages @$out quit END_OF_DATA run_bacula check_for_zombie_jobs storage=File stop_bacula COUNT_OTHER=`find ${tmp}/bacula-restores -type f | grep -v README | wc -l` COUNT_README=`find ${tmp}/bacula-restores -type f | grep README | wc -l` if [ $COUNT_OTHER -gt 0 -o $COUNT_README -lt 15 ]; then print_debug "Found non matching files" print_debug `find ${tmp}/bacula-restores -type f | grep -v README` rstat=2 fi #check_two_logs # don't work because of "warning file count mismatch" grep "Backup OK" ${tmp}/log1.out > /dev/null if [ $? -ne 0 ]; then print_debug "Found error on backup" bstat=2 fi end_test