diff options
| author | Florent Peyraud | 2018-01-02 17:32:05 +0100 | 
|---|---|---|
| committer | Florent Peyraud | 2018-01-02 17:32:05 +0100 | 
| commit | 6a31bee02035ecc31cb03e6d997e640e028e1309 (patch) | |
| tree | b40b3b5f5a72c5ca6e1df5b84e73a9ad34bf90b0 | |
| parent | 06b2fd46343a8ed778891c4d22c0d7e2e1807aa7 (diff) | |
| download | chouette-core-6a31bee02035ecc31cb03e6d997e640e028e1309.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 | 
