6 TestName="runscript-test"
12 rm -f bin/bacula-dir.conf
13 rm -f ${cwd}/tmp/RUN*log
14 rm -f ${cwd}/tmp/RUN_FD_FAILED
16 touch ${cwd}/tmp/log1.out
17 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
19 echo "${cwd}/build/po" >${cwd}/tmp/file-list
23 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
26 label volume=TestVolume001 pool=Scratch
27 @$out ${cwd}/tmp/RUN_FD_WARNING.log
28 run job=RUN_FD_WARNING yes
32 @$out ${cwd}/tmp/RUN_ALL_OK.log
33 run job=RUN_ALL_OK yes
37 @$out ${cwd}/tmp/RUN_FD_FAILED.log
38 run job=RUN_FD_FAILED yes
42 @$out ${cwd}/tmp/RUN_DIR_FAILED.log
43 run job=RUN_DIR_FAILED yes
47 @$out ${cwd}/tmp/RUN_FD_FAILED2.log
48 run job=RUN_FD_FAILED2 yes
52 @$out ${cwd}/tmp/RUN_RESTO.log
53 restore where=${cwd}/tmp/bacula-restores select all done yes
61 check_for_zombie_jobs storage=File
71 grep 'shell command: run BeforeJob "/bin/echo RunBeforeJob"' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
73 grep 'ClientRunBeforeJob: ClientRunBeforeJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
75 grep 'shell command: run ClientAfterJob "/bin/echo ClientRunAfterJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
77 grep 'shell command: run AfterJob "/bin/echo RunAfterJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
79 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
81 [ "$debug" = 1 ] && echo RUN_ALL_OK ok
83 echo "RUN_ALL_OK in error"
87 grep 'shell command: run BeforeJob "/bin/false RUN_DIR_FAILED"' ${cwd}/tmp/RUN_DIR_FAILED.log >/dev/null
89 grep 'AfterJob: RunAfterFailedJob' ${cwd}/tmp/RUN_DIR_FAILED.log >/dev/null
91 if [ $a = 0 -a $b = 0 ]
93 [ "$debug" = 1 ] && echo RUN_DIR_FAILED ok
95 echo "RUN_DIR_FAILED in error"
99 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
101 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
103 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED3"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
105 grep 'shell command: run AfterJob "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
107 grep 'touching' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
109 grep '*** Backup Error ***' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
111 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 -a $f = 0 ]
113 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
115 echo "RUN_FD_FAILED in error a=$a b=$b c=$c d=$d e=$e f=$f"
119 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
121 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
123 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED3"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
125 grep 'shell command: run AfterJob "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
127 grep '*** Backup Error ***' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
129 if [ $a = 0 -a $b != 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
131 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
133 echo "RUN_FD_FAILED2 in error a=$a b=$b c=$d d=$d e=$e"
137 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_WARNING"' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null
139 grep 'RunAfterFailedJob' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null
141 grep 'Backup OK -- with warnings' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null
143 if [ $a = 0 -a $b != 0 -a $c = 0 ]
145 [ "$debug" = 1 ] && echo RUN_FD_WARNING ok
147 echo "RUN_FD_WARNING in error"
151 grep 'ClientBeforeRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
153 grep 'ClientAfterRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
155 grep 'DirBeforeRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
157 grep 'DirAfterRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
159 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
161 [ "$debug" = 1 ] && echo RUN_RESTO ok
163 echo "RUN_RESTO in error"