1#!/bin/sh 2# 3# Run a simple backup but 4# split the archive into two volumes then bscan it 5# into the catalog after the backup. It also to a limited 6# extent tests the purge volume and delete volume commands. 7# 8 9TestName="bscan-test" 10JobName=bscan 11. scripts/functions 12 13scripts/cleanup 14scripts/copy-test-confs 15 16change_jobname NightlySave $JobName 17 18 19# Directory to backup. 20# This directory will be created by setup_data(). 21BackupDirectory="${tmp}/data" 22 23# Use a tgz to setup data to be backuped. 24# Data will be placed at "${tmp}/data/". 25setup_data data/small.tgz 26 27 28start_test 29 30cat <<END_OF_DATA >tmp/bconcmds 31@$out /dev/null 32messages 33@$out tmp/log1.out 34label storage=File1 35TestVolume001 36label storage=File1 37TestVolume002 38update Volume=TestVolume001 MaxVolBytes=10000 39run job=$JobName storage=File1 40yes 41wait 42list volumes 43list files jobid=1 44sql 45select * from JobMedia; 46 47 48messages 49@$out /dev/null 50@# 51@# now purge the Volume 52@# 53purge volume=TestVolume001 54purge volume=TestVolume002 55delete volume=TestVolume001 56yes 57delete volume=TestVolume002 58yes 59messages 60quit 61END_OF_DATA 62 63run_bareos 64check_for_zombie_jobs storage=File1 65stop_bareos 66 67echo "volume=TestVolume001" >tmp/bscan.bsr 68echo "volume=TestVolume002" >>tmp/bscan.bsr 69 70bscan_libdbi 71 72# If the database has a password pass it to bscan 73if test "x${db_password}" = "x"; then 74 PASSWD= 75else 76 PASSWD="-P ${db_password}" 77fi 78 79BSCAN_OUT="write_stdin_to_file ${tmp}/log-bscan.out" 80if is_debug; then 81 BSCAN_OUT="tee ${tmp}/log-bscan.out" 82fi 83 84#$bin/bscan -w ${working} $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -m -s -v -b tmp/bscan.bsr ${cwd}/tmp >tmp/log3.out 2>&1 85$bin/bscan -c ${conf} $BSCANLIBDBI -B ${DBTYPE} -n ${db_name} -u ${db_user} $PASSWD -m -s -v -b $tmp/bscan.bsr ${tmp} 2>&1 | $BSCAN_OUT 86 87cat <<END_OF_DATA >tmp/bconcmds 88@$out /dev/null 89messages 90@$out tmp/log2.out 91@# 92@# now do a restore 93@# 94@#setdebug level=400 storage=File1 95restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bareos-restores select all storage=File1 done 96yes 97wait 98messages 99quit 100END_OF_DATA 101 102# now run restore 103run_bareos 104check_for_zombie_jobs storage=File1 105stop_bareos 106 107check_two_logs 108check_restore_diff 109end_test 110