diff --git a/stack/monitor/buildout.cfg b/stack/monitor/buildout.cfg index cb7a1d0ba12cf1dd08eb8eac5097f8a85593f089..267f2b15c9fe83b7f989047a697ba4b6a12517c6 100644 --- a/stack/monitor/buildout.cfg +++ b/stack/monitor/buildout.cfg @@ -96,7 +96,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 = 870ff63cde9cc0f50fd7ad4b727bdf8c +md5sum = 5b6b7a96bfa1e0ca83310caa48ed7b20 context = key apache_location apache:location key gzip_location gzip:location diff --git a/stack/monitor/instance-monitor.cfg.jinja2.in b/stack/monitor/instance-monitor.cfg.jinja2.in index 92856c4de09b9bc85adf88f01945bb336a190619..000b38923040f3da3330f1c05c54e12351645db6 100644 --- a/stack/monitor/instance-monitor.cfg.jinja2.in +++ b/stack/monitor/instance-monitor.cfg.jinja2.in @@ -374,10 +374,12 @@ recipe = collective.recipe.template file = ${monitor-conf-parameters:promise-output-file} input = inline:#!{{ dash_executable_location }} pidfile=${monitor-conf-parameters:pid-file} - COMMAND=monitor.bootstrap if [ -s $pidfile ]; then - for i in {1..20}; do - if pid=`pgrep -F $pidfile -f "$COMMAND" 2>/dev/null`; then + COUNTER=0 + # Wait until max 20 seconds, the limit promise timeout + while [ $COUNTER -lt 20 ]; do + if [ -n "$(ps -p $(cat $pidfile) -o pid=)" ]; then + ((COUNTER=COUNTER+1)) sleep 0.5 else break