File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
echo " [II] qnib/init-plain script v0.4.23"
3
3
HEALTHCHECK_DIR=${HEALTHCHECK_DIR:-/ opt/ healthchecks/ }
4
- set -e
4
+ set -e
5
+ ERRORCODES=0
5
6
6
7
if [[ ! -d ${HEALTHCHECK_DIR} ]]; then
7
8
echo " > No healthcheck dir found '${HEALTHCHECK_DIR} '"
8
9
exit 0
9
10
fi
10
11
if [[ " X${ALLOW_HEALTHCHECK_OVERWRITE} " == " Xtrue" ]] && [[ -f ${HEALTHCHECK_DIR} /force_true ]]; then
11
- echo " > Healthcheck is set to OK via ' ${HEALTHCHECK_DIR} /force_true' and ALLOW_HEALTHCHECK_OVERWRITE=true "
12
- exit 0
12
+ echo " >> INITIALIZATION PHASE! Until HC successed the first time, it will be overwritten to be OK. "
13
+ set +e
13
14
fi
14
- while read -r line; do
15
+ while read -r line; do
15
16
echo " > execute healthcheck '${x} '"
16
17
${x}
18
+ EC=$?
19
+ if [[ ${EC} -ne 0 ]]; then
20
+ echo " >> Healthcheck failed, but as '${HEALTHCHECK_DIR} /force_true' is set it will be ignored"
21
+ fi
22
+ ERRORCODES+=$EC
17
23
done <<< $( find ${HEALTHCHECK_DIR} -type f -perm /u+x | sort)
24
+ if [[ ${ERRORCODES} == 0 ]]; then
25
+ echo " > INITIALIZATION stops, removing ''${HEALTHCHECK_DIR} /force_true'"
26
+ rm -f ${HEALTHCHECK_DIR} /force_true
27
+ fi
18
28
exit 0
You can’t perform that action at this time.
0 commit comments