3 # Test if Bacula can automatically create a Volume label.
6 TestName="runscript-test"
12 rm -f bin/bacula-dir.conf
13 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
15 echo "${cwd}/build" >${cwd}/tmp/file-list
19 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
22 label volume=TestVolume001
24 @#setdebug level=100 storage=File
25 @output ${cwd}/tmp/log.RUN2.out
26 run job=RUN_FD_WARNING yes
30 run job=RUN_ALL_OK yes
34 run job=RUN_FD_FAILED yes
38 run job=RUN_DIR_FAILED yes
48 cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf &> ${cwd}/tmp/log.RUN1.out
52 if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' ${cwd}/tmp/log.RUN1.out &&
53 grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob' ${cwd}/tmp/log.RUN1.out &&
54 grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' ${cwd}/tmp/log.RUN1.out &&
55 grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob' ${cwd}/tmp/log.RUN1.out
57 [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok
59 echo "RUN_ALL_OK in error"
63 if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' ${cwd}/tmp/log.RUN1.out &&
64 grep -q 'dir: BeforeJob: RunAfterFailedJob' ${cwd}/tmp/log.RUN1.out &&
65 true # grep -q 'Backup OK -- with warnings' ${cwd}/tmp/log.RUN1.out
67 [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok
69 echo "RUN_DIR_FAILED in error"
73 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/log.RUN1.out &&
74 grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/log.RUN1.out &&
75 grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/log.RUN1.out
77 [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok
79 echo "RUN_FD_FAILED in error"
83 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' ${cwd}/tmp/log.RUN1.out &&
84 grep -q 'Backup OK -- with warnings' ${cwd}/tmp/log.RUN1.out
86 [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok
88 echo "RUN_FD_WARNING in error"