From 646d0eff15ee009a848c3146cba4708a22a385ac Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sun, 1 May 2022 22:13:11 -0700 Subject: [PATCH] change the environmental variable to COLLECTOR_CRON_SCHEDULE --- README.md | 4 ++-- docker/entrypoint-collector.sh | 4 ++-- rootfs/etc/cont-init.d/50-config | 4 ++-- rootfs/etc/cron.d/scrutiny | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 885b6b6..e29e5c7 100644 --- a/README.md +++ b/README.md @@ -151,9 +151,9 @@ Neither file is required, however if provided, it allows you to configure how Sc ## Cron Schedule Unfortunately the Cron schedule cannot be configured via the `collector.yaml` (as the collector binary needs to be trigged by a scheduler/cron). However, if you are using the official `ghcr.io/analogj/scrutiny:master-collector` or `ghcr.io/analogj/scrutiny:master-omnibus` docker images, -you can use the `SCRUTINY_COLLECTOR_CRON_SCHEDULE` environmental variable to override the default cron schedule (daily @ midnight - `0 0 * * *`). +you can use the `COLLECTOR_CRON_SCHEDULE` environmental variable to override the default cron schedule (daily @ midnight - `0 0 * * *`). -`docker run -e SCRUTINY_COLLECTOR_CRON_SCHEDULE="0 0 * * *" ...` +`docker run -e COLLECTOR_CRON_SCHEDULE="0 0 * * *" ...` ## Notifications diff --git a/docker/entrypoint-collector.sh b/docker/entrypoint-collector.sh index c94a67b..69ed815 100755 --- a/docker/entrypoint-collector.sh +++ b/docker/entrypoint-collector.sh @@ -6,8 +6,8 @@ printenv | sed 's/^\(.*\)$/export \1/g' > /env.sh # adding ability to customize the cron schedule. -SCRUTINY_COLLECTOR_CRON_SCHEDULE=${SCRUTINY_COLLECTOR_CRON_SCHEDULE:-"0 0 * * *"} -sed -i 's|{SCRUTINY_COLLECTOR_CRON_SCHEDULE}|'"${SCRUTINY_COLLECTOR_CRON_SCHEDULE}"'|g' /etc/cron.d/scrutiny +COLLECTOR_CRON_SCHEDULE=${COLLECTOR_CRON_SCHEDULE:-"0 0 * * *"} +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 echo "starting cron" diff --git a/rootfs/etc/cont-init.d/50-config b/rootfs/etc/cont-init.d/50-config index 3c7cece..8ff0d45 100644 --- a/rootfs/etc/cont-init.d/50-config +++ b/rootfs/etc/cont-init.d/50-config @@ -1,4 +1,4 @@ #!/usr/bin/with-contenv bash -SCRUTINY_COLLECTOR_CRON_SCHEDULE=${SCRUTINY_COLLECTOR_CRON_SCHEDULE:-"0 0 * * *"} -sed -i 's|{SCRUTINY_COLLECTOR_CRON_SCHEDULE}|'"${SCRUTINY_COLLECTOR_CRON_SCHEDULE}"'|g' /etc/cron.d/scrutiny \ No newline at end of file +COLLECTOR_CRON_SCHEDULE=${COLLECTOR_CRON_SCHEDULE:-"0 0 * * *"} +sed -i 's|{COLLECTOR_CRON_SCHEDULE}|'"${COLLECTOR_CRON_SCHEDULE}"'|g' /etc/cron.d/scrutiny \ No newline at end of file diff --git a/rootfs/etc/cron.d/scrutiny b/rootfs/etc/cron.d/scrutiny index 9571f4b..f112b8e 100644 --- a/rootfs/etc/cron.d/scrutiny +++ b/rootfs/etc/cron.d/scrutiny @@ -11,5 +11,5 @@ MAILTO="" # correctly route collector logs (STDOUT & STDERR) to Cron foreground (collectable by Docker STDOUT) # cron schedule to run daily at midnight: '0 0 * * *' # System environmental variables are stripped by cron, source our dump of the docker environmental variables before each command (/env.sh) -{SCRUTINY_COLLECTOR_CRON_SCHEDULE} root . /env.sh; /scrutiny/bin/scrutiny-collector-metrics run >/proc/1/fd/1 2>/proc/1/fd/2 +{COLLECTOR_CRON_SCHEDULE} root . /env.sh; /scrutiny/bin/scrutiny-collector-metrics run >/proc/1/fd/1 2>/proc/1/fd/2 # An empty line is required at the end of this file for a valid cron file.