diff options
| author | Florent Peyraud | 2018-01-02 17:32:05 +0100 | 
|---|---|---|
| committer | Alban Peignier | 2018-01-07 23:22:20 +0100 | 
| commit | 45efb11e8ab4e7fd027dc0f019089d382fca86a6 (patch) | |
| tree | 75ebf596f483503c1fa1f6f359a3b66de58f0a30 | |
| parent | e227e938647f75a253fd938b494dfad56e47ec6f (diff) | |
| download | chouette-core-45efb11e8ab4e7fd027dc0f019089d382fca86a6.tar.bz2 | |
Add launch-cron script
| -rw-r--r-- | script/launch-cron | 20 | 
1 files changed, 20 insertions, 0 deletions
| diff --git a/script/launch-cron b/script/launch-cron new file mode 100644 index 000000000..73885bd75 --- /dev/null +++ b/script/launch-cron @@ -0,0 +1,20 @@ +#!/bin/bash + +function append_var_if_defined +{ +    VAR_NAME=$1 +    OUTPUT=$2 +    env|grep -E "^${VAR_NAME}=">>${OUTPUT} +} +VAR_LIST="RAILS_DB_HOST RAILS_DB_PORT RAILS_DB_USER RAILS_DB_PASSWORD RAILS_DB_NAME API_KEYS ISSUE_CATEGORIES MAIL_HOST MAIL_ASSETS_URL_BASE MAIL_FROM SMTP_HOST LDAP_INT_HOST LDAP_INT_PORT LDAP_INT_BASE LDAP_EXT_HOST LDAP_EXT_USER LDAP_EXT_PASSWORD LDAP_EXT_BASE LDAP_EXT_OBJECT_CLASS SECRET_BASE SIDEKIQ_REDIS_URL CODIFLIGNE_API_URL SWAGGER_PATH REDIS_CACHE_STORE_URL CACHE_STORE_TIMEOUT RAILS_LOG_TO_STDOUT" + +TMPF=$(tempfile) +for v in $VAR_LIST; do +    append_var_if_defined $v $TMPF    +done + +crontab -l >> $TMPF +cat $TMPF |crontab - +rm $TMPF + +exec cron -f | 
