3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Test the RescheduleOnError function
8 TestName="restart-reschedule-test"
13 scripts/copy-migration-confs
14 scripts/prepare-disk-changer
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
18 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
21 # Zap out any schedule in default conf file so that
22 # it doesn't start during our test
25 echo "s% Schedule =%# Schedule =%g" >${outf}
26 cp $scripts/bacula-dir.conf $tmp/1
27 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
29 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "RescheduleOnError", "yes", "Job")'
30 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "RescheduleInterval", "10", "Job")'
31 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "RescheduleTimes", "3", "Job")'
32 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "LabelFormat", "Vol", "Pool")'
33 $bperl -e 'add_attribute("$conf/bacula-sd.conf", "LabelMedia", "Yes", "Device", "FileStorage")'
35 change_jobname NightlySave $JobName
38 cat <<END_OF_DATA >$tmp/bconcmds
42 label volume=TestVolume001 pool=Scratch storage=DiskChanger slot=1 drive=0
43 label volume=TestVolume002 pool=Scratch storage=DiskChanger slot=2 drive=0
44 label volume=TestVolume003 pool=Scratch storage=DiskChanger slot=3 drive=0
45 setdebug hangup=200 level=0 client
48 @# Wait for the incomplete job
52 @# Wait for the reschedule
59 restore where=$tmp/bacula-restores select all done
64 @#setdebug hangup=200 level=0 storage
65 @# Test Reschedule with copy jobs
66 run job=copy-job jobid=1 yes
74 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "RescheduleIncompleteJobs", "no", "Job")'
76 cat <<END_OF_DATA >$tmp/bconcmds
79 @# Test stop/resume with incomplete
80 setbandwidth limit=1000 client
81 run job=$JobName jobid=1 level=full yes
85 setbandwidth limit=10000000 client
93 restore where=$tmp/bacula-restores4
108 check_for_zombie_jobs storage=File1
112 $rscripts/diff.pl -s $cwd/build -d $tmp/bacula-restores/$cwd/build
113 bstat=`expr $bstat + $?`
114 $rscripts/diff.pl -s $cwd/build -d $tmp/bacula-restores4/$cwd/build
115 bstat=`expr $bstat + $?`
117 nb=`grep Incomplete $tmp/log4.out | wc -l`
118 if [ "$nb" -ne 1 ]; then
119 print_debug "ERROR: Expected 1 incomplete job in status dir output $tmp/log4.out, got $nb"
123 nb=`grep ' 5.* I ' $tmp/log4.out | wc -l`
124 if [ "$nb" -ne 1 ]; then
125 print_debug "ERROR: Expected 1 incomplete job in status dir output $tmp/log4.out, got $nb"