Commit d6d873c4 authored by Alain Takoudjou's avatar Alain Takoudjou

monitor: bootstrap promise don't fail if pid file doesn't exists

parent 89b6630e
...@@ -93,7 +93,7 @@ recipe = slapos.recipe.template:jinja2 ...@@ -93,7 +93,7 @@ recipe = slapos.recipe.template:jinja2
filename = template-monitor.cfg filename = template-monitor.cfg
template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in
rendered = ${buildout:directory}/template-monitor.cfg rendered = ${buildout:directory}/template-monitor.cfg
md5sum = c25e1c8206fb7c08924ae3d5c16521fc md5sum = 61734742e3a01a8a1d512f491b2190cc
context = context =
key apache_location apache:location key apache_location apache:location
key gzip_location gzip:location key gzip_location gzip:location
......
...@@ -372,17 +372,19 @@ check-secure = 1 ...@@ -372,17 +372,19 @@ check-secure = 1
recipe = collective.recipe.template recipe = collective.recipe.template
file = ${monitor-conf-parameters:promise-output-file} file = ${monitor-conf-parameters:promise-output-file}
input = inline:#!{{ dash_executable_location }} input = inline:#!{{ dash_executable_location }}
PID=`cat ${monitor-conf-parameters:pid-file}` if [ -f "${monitor-conf-parameters:pid-file}" ]; then
for i in {1..20}; do PID=`cat ${monitor-conf-parameters:pid-file}`
# wait for monitor bootstrap script to finish (max 10 seconds) for i in {1..20}; do
kill -0 "$PID" > /dev/null 2>&1 # wait for monitor bootstrap script to finish (max 10 seconds)
RETURN_CODE=$? kill -0 "$PID" > /dev/null 2>&1
if [ $RETURN_CODE -eq 0 ] ; then RETURN_CODE=$?
break if [ $RETURN_CODE -eq 0 ] ; then
else break
sleep 0.5 else
fi sleep 0.5
done fi
done
fi
if [ ! -f "${:file}" ]; then echo "Monitor bootstrap exited with error." && exit 2; else echo "Bootstrap OK"; fi if [ ! -f "${:file}" ]; then echo "Monitor bootstrap exited with error." && exit 2; else echo "Bootstrap OK"; fi
output = ${directory:promises}/monitor-bootstrap-status output = ${directory:promises}/monitor-bootstrap-status
mode = 700 mode = 700
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment