1#!/bin/sh 2# 3# Run a simple backup. Then create some 4# new files, do an Incremental and restore those two files. 5# 6TestName="incremental-test" 7JobName=Incremental 8. scripts/functions 9 10${rscripts}/cleanup 11${rscripts}/copy-test-confs 12change_jobname CompressedTest $JobName 13 14# Directory to backup. 15# This directory will be created by setup_data(). 16BackupDirectory="${tmp}/data" 17 18# Use a tgz to setup data to be backuped. 19# Data will be placed at "${tmp}/data/". 20setup_data data/small.tgz 21 22# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 23echo "${BackupDirectory}" >${tmp}/file-list 24 25echo "${BackupDirectory}/ficheriro1.txt" >${tmp}/restore-list 26echo "${BackupDirectory}/ficheriro2.txt" >>${tmp}/restore-list 27 28 29start_test 30 31cat <<END_OF_DATA >${tmp}/bconcmds 32@$out /dev/null 33messages 34@$out ${tmp}/log1.out 35@#setdebug level=100 storage=File 36@#setdebug level=200 client 37@#setdebug level=100 director 38label storage=File volume=TestVolume001 39label storage=File volume=TestVolume002 40run job=$JobName yes 41status client 42wait 43messages 44quit 45END_OF_DATA 46 47run_bareos 48check_for_zombie_jobs storage=File 49# 50# Now create two new files to be restored later 51# 52#sleep 1 53echo "ficheriro1.txt" >${BackupDirectory}/ficheriro1.txt 54echo "ficheriro2.txt" >${BackupDirectory}/ficheriro2.txt 55 56cat <<END_OF_DATA >${tmp}/bconcmds 57@$out /dev/null 58messages 59@$out ${tmp}/log1.out 60@# Force Incremental on the second Volume 61update volume=TestVolume001 VolStatus=Used 62run level=Differential job=$JobName yes 63wait 64messages 65quit 66END_OF_DATA 67 68run_bconsole 69 70#sleep 1 71touch ${BackupDirectory}/ficheriro1.txt 72touch ${BackupDirectory}/ficheriro2.txt 73 74cat <<END_OF_DATA >${tmp}/bconcmds 75@$out /dev/null 76messages 77@$out ${tmp}/log1.out 78run level=Incremental job=$JobName yes 79wait 80messages 81quit 82END_OF_DATA 83 84run_bconsole 85 86#sleep 1 87echo "next ficheriro1.txt" >>${BackupDirectory}/ficheriro1.txt 88echo "next ficheriro2.txt" >>${BackupDirectory}/ficheriro2.txt 89 90cat <<END_OF_DATA >${tmp}/bconcmds 91@$out /dev/null 92messages 93@$out ${tmp}/log1.out 94run level=Differential job=$JobName yes 95wait 96messages 97quit 98END_OF_DATA 99 100run_bconsole 101 102#sleep 1 103touch ${BackupDirectory}/ficheriro1.txt 104touch ${BackupDirectory}/ficheriro2.txt 105 106cat <<END_OF_DATA >${tmp}/bconcmds 107@$out /dev/null 108messages 109@$out ${tmp}/log1.out 110run level=Incremental job=$JobName yes 111wait 112messages 113quit 114END_OF_DATA 115 116run_bconsole 117 118#sleep 1 119touch ${BackupDirectory}/ficheriro1.txt 120touch ${BackupDirectory}/ficheriro2.txt 121 122cat <<END_OF_DATA >${tmp}/bconcmds 123@$out /dev/null 124messages 125@$out ${tmp}/log1.out 126run level=Incremental job=$JobName yes 127wait 128messages 129quit 130END_OF_DATA 131 132run_bconsole 133 134#sleep 1 135touch ${BackupDirectory}/ficheriro1.txt 136touch ${BackupDirectory}/ficheriro2.txt 137 138cat <<END_OF_DATA >${tmp}/bconcmds 139@$out /dev/null 140messages 141@$out ${tmp}/log1.out 142run level=Incremental job=$JobName yes 143wait 144messages 145quit 146END_OF_DATA 147 148run_bconsole 149 150# make sure, timestamp differs 151sleep 1 152 153echo "last test" >> ${BackupDirectory}/ficheriro1.txt 154echo "last test" >> ${BackupDirectory}/ficheriro2.txt 155 156cat <<END_OF_DATA >${tmp}/bconcmds 157@$out /dev/null 158messages 159@$out ${tmp}/log1.out 160setdebug level=200 storage=File 161run level=Incremental job=$JobName yes 162wait 163messages 164@# 165@# now do a restore 166@# 167@$out ${tmp}/log2.out 168setdebug level=10 storage=File 169restore where=${tmp}/bareos-restores storage=File file=<${tmp}/restore-list 170yes 171wait 172status client 173status storage=File 174messages 175quit 176END_OF_DATA 177 178run_bconsole 179check_for_zombie_jobs storage=File 180stop_bareos 181 182check_two_logs 183check_restore_files_diff `cat ${tmp}/restore-list` 184 185end_test 186