Skip to content

Commit

Permalink
fixing cron.
Browse files Browse the repository at this point in the history
related #121
  • Loading branch information
AnalogJ committed May 12, 2022
1 parent eeb086c commit a004f85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker/entrypoint-collector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ printenv | sed 's/^\(.*\)$/export \1/g' > /env.sh

# adding ability to customize the cron schedule.
COLLECTOR_CRON_SCHEDULE=${COLLECTOR_CRON_SCHEDULE:-"0 0 * * *"}

# if the cron schedule has been overridden via env variable (eg docker-compose) we should make sure to strip quotes
[[ "${COLLECTOR_CRON_SCHEDULE}" == \"*\" || "${COLLECTOR_CRON_SCHEDULE}" == \'*\' ]] && COLLECTOR_CRON_SCHEDULE="${COLLECTOR_CRON_SCHEDULE:1:-1}"

sed -i 's|{COLLECTOR_CRON_SCHEDULE}|'"${COLLECTOR_CRON_SCHEDULE}"'|g' /etc/cron.d/scrutiny

# now that we have the env start cron in the foreground
Expand Down
5 changes: 5 additions & 0 deletions rootfs/etc/cont-init.d/50-config
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/with-contenv bash

COLLECTOR_CRON_SCHEDULE=${COLLECTOR_CRON_SCHEDULE:-"0 0 * * *"}

# if the cron schedule has been overridden via env variable (eg docker-compose) we should make sure to strip quotes
[[ "${COLLECTOR_CRON_SCHEDULE}" == \"*\" || "${COLLECTOR_CRON_SCHEDULE}" == \'*\' ]] && COLLECTOR_CRON_SCHEDULE="${COLLECTOR_CRON_SCHEDULE:1:-1}"

# replace placeholder with correct value
sed -i 's|{COLLECTOR_CRON_SCHEDULE}|'"${COLLECTOR_CRON_SCHEDULE}"'|g' /etc/cron.d/scrutiny

0 comments on commit a004f85

Please sign in to comment.