File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -15,17 +15,25 @@ function setup() {
15
15
fi
16
16
}
17
17
function wait_for_cron() {
18
- CURL=" curl --write-out '%{http_code}' -so /dev/null worker-cron:8087/$PLONE_PATH /@@ok"
19
- echo " Waiting instance-cron ..."
20
- sleep 20
21
- response=$( $CURL )
22
- echo " received response $response "
23
- while [[ " $response " != " '200'" ]]; do
24
- echo " Waiting instance-cron ..."
25
- sleep 10
18
+ URL=" worker-cron:8087/$PLONE_PATH "
19
+ CURL=" curl --write-out %{http_code} -so /dev/null $URL /@@ok"
20
+ MAX_TRIES=240
21
+ INTERVAL=1
22
+ SECONDS=0
23
+ response=" $( $CURL ) "
24
+ tries=1
25
+ while [[ $response != " 200" && $tries -lt $MAX_TRIES ]]
26
+ do
27
+ sleep $INTERVAL
26
28
response=$( $CURL )
27
- echo " received response $response "
29
+ (( tries += 1 ))
28
30
done
31
+ if [[ $tries == " $MAX_TRIES " ]]; then
32
+ echo " Failed to reach $URL after $SECONDS s"
33
+ exit 1
34
+ else
35
+ echo " $URL is up. Waited $SECONDS s"
36
+ fi
29
37
}
30
38
function start() {
31
39
echo " Starting $1 "
You can’t perform that action at this time.
0 commit comments