3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Run a backup of the build directory but force it to have
7 # a comm error, and check that it restarts correctly.
9 TestName="restart2-job-test"
14 scripts/copy-test-confs
15 setup_shstore # simulate shared storage if enabled
16 echo "${cwd}/build" >${cwd}/tmp/file-list
18 change_jobname NightlySave $JobName
19 $bperl -e 'add_attribute("$conf/bacula-fd.conf", "MaximumBandwidthPerJob", "100 kB/s", "FileDaemon")'
23 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
26 @$out ${cwd}/tmp/log1.out
27 @#setdebug level=0 trace=0 hangup=469 client
28 @#setdebug level=20 dir
29 label storage=File volume=TestVolume001
36 run_bacula 2>/dev/null
38 # Note, the following stops and restarts the FD while it
39 # is running to simulate a crash, so it is normal if
40 # orphanned buffers are reported
42 $scripts/bacula-ctl-fd stop >/dev/null 2>&1
44 $scripts/bacula-ctl-fd start 1>/dev/null 2>&1
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 @$out ${cwd}/tmp/log1.out
56 # Note, the following stops and restarts the FD while it
57 # is running to simulate a crash, so it is normal if
58 # orphanned buffers are reported
60 $scripts/bacula-ctl-fd stop >/dev/null 2>&1
62 $scripts/bacula-ctl-fd start >/dev/null 2>&1
65 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
66 @$out ${cwd}/tmp/log1.out
75 # This is the last backup, so make it run in a reasonable time
77 $bperl -e 'add_attribute("$conf/bacula-fd.conf", "MaximumBandwidthPerJob", "500000 kB/s", "FileDaemon")'
80 $scripts/bacula-ctl-fd stop >/dev/null 2>&1
82 $scripts/bacula-ctl-fd start
85 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
86 @$out ${cwd}/tmp/log1.out
90 select * from JobMedia where JobId=1;
98 scripts/check_for_zombie_jobs storage=File
100 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
106 @$out ${cwd}/tmp/log2.out
107 @#setdebug level=50 storage=File
108 restore where=$tmp/bacula-restores storage=File select all done
120 scripts/check_for_zombie_jobs storage=File
126 grep "Sending Accurate" $tmp/log1.out >/dev/null
128 print_debug "ERROR: Second job should use Accurate"