addign ability to customize the scrutiny collector cron schedule using SCRUTINY_COLLECTOR_CRON_SCHEDULE env variable.
similar to https://github.com/linuxserver/docker-scrutiny/pull/19 fixes https://github.com/linuxserver/docker-scrutiny/issues/17 fixes https://github.com/AnalogJ/scrutiny/issues/161 fixes https://github.com/AnalogJ/scrutiny/issues/66 fixes https://github.com/AnalogJ/scrutiny/issues/202 fixes https://github.com/AnalogJ/scrutiny/issues/121
This commit is contained in:
@@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
printenv | sed 's/^\(.*\)$/export \1/g' > /env.sh
|
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
|
||||||
|
|
||||||
# now that we have the env start cron in the foreground
|
# now that we have the env start cron in the foreground
|
||||||
echo "starting cron"
|
echo "starting cron"
|
||||||
su -c "cron -l 8 -f" root
|
su -c "cron -l 8 -f" root
|
||||||
|
|||||||
@@ -0,0 +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
|
||||||
@@ -11,5 +11,5 @@ MAILTO=""
|
|||||||
# correctly route collector logs (STDOUT & STDERR) to Cron foreground (collectable by Docker STDOUT)
|
# correctly route collector logs (STDOUT & STDERR) to Cron foreground (collectable by Docker STDOUT)
|
||||||
# cron schedule to run daily at midnight: '0 0 * * *'
|
# 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)
|
# System environmental variables are stripped by cron, source our dump of the docker environmental variables before each command (/env.sh)
|
||||||
0 0 * * * root . /env.sh; /scrutiny/bin/scrutiny-collector-metrics run >/proc/1/fd/1 2>/proc/1/fd/2
|
{SCRUTINY_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.
|
# An empty line is required at the end of this file for a valid cron file.
|
||||||
|
|||||||
Reference in New Issue
Block a user