"MAILTO" Environment Variable is ignored when set in a file in /etc/cron.d/
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cron (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I have a cron job definition file with the following:
----------------
# Runs every 5 minutes, logging into the proftpd database checking for expired accounts and disabling them.
MAILTO=
*/5 * * * * root /usr/local/
----------------
Any output from the script ought to be emailed to both the sysadmin & io group addresses, but instead output is always sent to 'root@[local FQDN]', presumably becasue the cron job is being executed as root. For some reason, the MAILTO environment variable is being ignored, as can be confirmed when looking at the email (sent to root) for all the "X-cron-env" headers:
----------------
X-cron-env: <SHELL=/bin/sh>
X-cron-env: <HOME=/root>
X-cron-env: <PATH=/
X-cron-env: <LOGNAME=root>
----------------
There is clearly no MAILTO header in this email, and obviously the main proof is that this still only went to root@fqdn.
All documentation appears to say that the combination of MAILTO and a file in /etc/cron.d/ should work.
Status changed to 'Confirmed' because the bug affects multiple users.