Commit 55cfe1bb authored by Rafael Monnerat's avatar Rafael Monnerat

stack/monitor: Fix promise for the running process

  Kill -0 were making the promise exit.
parent 78cc6e27
......@@ -93,7 +93,7 @@ recipe = slapos.recipe.template:jinja2
filename = template-monitor.cfg
template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in
rendered = ${buildout:directory}/template-monitor.cfg
md5sum = 0955530291105a322f2972244caf307d
md5sum = 266f23bc836a938ac69ce0bc674f34fe
context =
key apache_location apache:location
key gzip_location gzip:location
......
......@@ -373,16 +373,14 @@ check-secure = 1
recipe = collective.recipe.template
file = ${monitor-conf-parameters:promise-output-file}
input = inline:#!{{ dash_executable_location }}
if [ -f "${monitor-conf-parameters:pid-file}" ]; then
PID=`cat ${monitor-conf-parameters:pid-file}`
pidfile=${monitor-conf-parameters:pid-file}
COMMAND=monitor.bootstrap
if [ -s $pidfile ]; then
for i in {1..20}; do
# wait for monitor bootstrap script to finish (max 10 seconds)
kill -0 "$PID" > /dev/null 2>&1
RETURN_CODE=$?
if [ $RETURN_CODE -eq 0 ] ; then
break
else
if pid=`pgrep -F $pidfile -f "$COMMAND" 2>/dev/null`; then
sleep 0.5
else
break
fi
done
fi
......
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