diff --git a/software/apache-frontend/buildout.hash.cfg b/software/apache-frontend/buildout.hash.cfg index 7701c941d6fb4b24d9d1d6a7fb630bb046411559..e3fe993b08d501cb20b564990fc544140729e767 100644 --- a/software/apache-frontend/buildout.hash.cfg +++ b/software/apache-frontend/buildout.hash.cfg @@ -19,7 +19,7 @@ md5sum = f686f765e55d1dce2e55a400f0714b3e [template-apache-frontend] filename = instance-apache-frontend.cfg -md5sum = e2f60121bc1116319b4d20b4c4badc1c +md5sum = ea599162be999680cd43d4605762219f [template-apache-replicate] filename = instance-apache-replicate.cfg.in @@ -92,3 +92,7 @@ md5sum = a5186f666acb2f040ede04c91e60408f [template-nginx-notebook-slave-virtualhost] filename = templates/nginx-notebook-slave.conf.in md5sum = 82d74a7f2aceb2b4a7acc6259291b7f2 + +[template-apache-lazy-script-call.sh.in] +filename = templates/apache-lazy-script-call.sh.in +md5sum = f519bea5b54448c5ad486c4ef6c0fb23 diff --git a/software/apache-frontend/common.cfg b/software/apache-frontend/common.cfg index 48093cacfd09bd610d8597d1947b2f018c25f9ff..9e570659e531a336e9e66ef8c78285892d04a257 100644 --- a/software/apache-frontend/common.cfg +++ b/software/apache-frontend/common.cfg @@ -141,6 +141,11 @@ url = ${:_profile_base_location_}/templates/nginx.cfg.in output = ${buildout:directory}/template-nginx.cfg.in mode = 0644 +[template-apache-lazy-script-call] +<=download-template +filename = apache-lazy-script-call.sh.in + + [template-nginx-eventsource-slave-virtualhost] <=download-template filename = nginx-eventsource-slave.conf.in diff --git a/software/apache-frontend/instance-apache-frontend.cfg b/software/apache-frontend/instance-apache-frontend.cfg index b649c4daeb93d539ace70f289f64d024faa18b9e..42e993cee1f143f98efb158251635a93ba2bec8a 100644 --- a/software/apache-frontend/instance-apache-frontend.cfg +++ b/software/apache-frontend/instance-apache-frontend.cfg @@ -508,6 +508,19 @@ mode = 0700 extra-context = key content apache-configuration:frontend-graceful-command + +[frontend-apache-lazy-graceful] +< = jinja2-template-base +template = ${template-apache-lazy-script-call:output} +rendered = $${directory:bin}/frontend-apache-lazy-graceful +mode = 0700 +extra-context = + raw wait_time 60 + key content apache-configuration:frontend-graceful-command + + + + # Promises checking configuration: [promise-frontend-apache-configuration] < = jinja2-template-base diff --git a/software/apache-frontend/templates/apache-lazy-script-call.sh.in b/software/apache-frontend/templates/apache-lazy-script-call.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..acb729f819f2e40dd67750824f2321718160c6ea --- /dev/null +++ b/software/apache-frontend/templates/apache-lazy-script-call.sh.in @@ -0,0 +1,18 @@ +#!/bin/bash + +PID=$$ +PIDFILE=~/my.pid + +if [ ! -f $PIDFILE ]; then + echo $PID >> $PIDFILE +else + ps --pid `cat $PIDFILE` &>/dev/null + if [ $? -eq 0 ]; then + echo "Skipped" + else + echo $PID >> $PIDFILE + sleep {{ wait_time }} + {{ lazy_command }} + fi +fi +