6 TestName="runscript-test"
12 rm -f bin/bacula-dir.conf
14 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
16 echo "${cwd}/build/po" >/tmp/file-list
20 cat <<END_OF_DATA >tmp/bconcmds
23 label volume=TestVolume001
24 @$out tmp/RUN_FD_WARNING.log
25 run job=RUN_FD_WARNING yes
29 @$out tmp/RUN_ALL_OK.log
30 run job=RUN_ALL_OK yes
34 @$out tmp/RUN_FD_FAILED.log
35 run job=RUN_FD_FAILED yes
39 @$out tmp/RUN_DIR_FAILED.log
40 run job=RUN_DIR_FAILED yes
44 @$out tmp/RUN_FD_FAILED2.log
45 run job=RUN_FD_FAILED2 yes
54 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf > /dev/null
64 grep 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/RUN_ALL_OK.log >/dev/null 2>&1
66 grep 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
68 grep 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
70 grep 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
72 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
74 [ "$debug" = 1 ] && echo RUN_ALL_OK ok
76 echo "RUN_ALL_OK in error"
80 grep 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
82 grep 'dir: AfterJob: RunAfterFailedJob' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
84 if [ $a = 0 -a $b = 0 ]
86 [ "$debug" = 1 ] && echo RUN_DIR_FAILED ok
88 echo "RUN_DIR_FAILED in error"
92 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
94 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
96 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
98 grep '*** Backup Error ***' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
100 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
102 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
104 echo "RUN_FD_FAILED in error"
108 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
110 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
112 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
114 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
116 grep '*** Backup Error ***' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
118 if [ $a = 0 -a $b != 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
120 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
122 echo "RUN_FD_FAILED2 in error"
126 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
128 grep 'RunAfterFailedJob' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
130 grep 'Backup OK -- with warnings' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
132 if [ $a = 0 -a $b != 0 -a $c = 0 ]
134 [ "$debug" = 1 ] && echo RUN_FD_WARNING ok
136 echo "RUN_FD_WARNING in error"