blog.iankulin.com

Cron

User environment variables are not available in cron

Docker environment variables set for a container aren’t available to scripts run by cron inside it, even when cron runs as the same user. After confirming the cause and finding no clean fix, I settle on a workaround: saving the needed variable to a file in the entry point script and reading it back from the cron job...

Outputting to the console, in Docker, from a cron job

How to get console output from a cron job running inside a Docker container. I cover running cron in the foreground so the container doesn’t exit, and redirecting job output to /proc/1/fd/1 so it appears in the container’s stdout, since cron normally sends output to mail. I mention common gotchas like user permissions and file paths, with an example project on GitHub...