@ -7,6 +7,8 @@
# adding ability to customize the cron schedule.
# adding ability to customize the cron schedule.
COLLECTOR_CRON_SCHEDULE = ${ COLLECTOR_CRON_SCHEDULE :- "0 0 * * *" }
COLLECTOR_CRON_SCHEDULE = ${ COLLECTOR_CRON_SCHEDULE :- "0 0 * * *" }
COLLECTOR_RUN_STARTUP = ${ COLLECTOR_RUN_STARTUP :- "false" }
COLLECTOR_RUN_STARTUP_SLEEP = ${ COLLECTOR_RUN_STARTUP_SLEEP :- "1" }
# if the cron schedule has been overridden via env variable (eg docker-compose) we should make sure to strip quotes
# 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 } "
[ [ " ${ COLLECTOR_CRON_SCHEDULE } " = = \" *\" || " ${ COLLECTOR_CRON_SCHEDULE } " = = \' *\' ] ] && COLLECTOR_CRON_SCHEDULE = " ${ COLLECTOR_CRON_SCHEDULE : 1 :- 1 } "
@ -14,6 +16,13 @@ COLLECTOR_CRON_SCHEDULE=${COLLECTOR_CRON_SCHEDULE:-"0 0 * * *"}
# replace placeholder with correct value
# replace placeholder with correct value
sed -i 's|{COLLECTOR_CRON_SCHEDULE}|' " ${ COLLECTOR_CRON_SCHEDULE } " '|g' /etc/cron.d/scrutiny
sed -i 's|{COLLECTOR_CRON_SCHEDULE}|' " ${ COLLECTOR_CRON_SCHEDULE } " '|g' /etc/cron.d/scrutiny
if [ [ " ${ COLLECTOR_RUN_STARTUP } " = = "true" ] ] ; then
sleep ${ COLLECTOR_RUN_STARTUP_SLEEP }
echo "starting scrutiny collector (run-once mode. subsequent calls will be triggered via cron service)"
/opt/scrutiny/bin/scrutiny-collector-metrics run
fi
# 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 -f -L 15" root
su -c "cron -f -L 15" root