For a long time, I have been used to thinking that any environment I wanted in cron, I basically needed to set in the crontab itself -- see the "Different Environment", likely top answer here: Reasons why crontab does not work
but... on my recent Ubuntu 14.04 install, I have a crontab that looks like this:
*/1 * * * * env > /tmp/cron.env
an /etc/environment file that looks like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
RACK_ENV=production
LC_ALL=en_US.UTF-8
FROM_ETC_ENVIRONMENT=testing
and the output cron.env file looks like this:
FROM_ETC_ENVIRONMENT=testing
HOME=/home/devops
LOGNAME=devops
RACK_ENV=production
PATH=/usr/bin:/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
LC_ALL=en_US.UTF-8
PWD=/home/devops
the FROM_ETC_ENVIRONMENT is a variable I created with that unique name to ensure it couldn't possibly be coming from anywhere else.
I've looked around for documentation on when this might have changed / etc... I guess my question is really this:
Is this a behavior I can rely on from Ubuntu 14.04 going forward? (Anyone know when it was introduced? Or has it always been this way, and I just didn't realize it -- the top answer in the Reasons why crontab does not work link says that cron doesn't read from /etc/environment at all, but that seems to be wrong based on my tests.