Next: Logging output to syslog, Up: Cronjob Output [Contents][Index]
The default behavior is to mail the cronjob output to the user on
whose behalf the cronjob is run. The message From:
header is
constructed as follows:
From: (Cron daemon) <owner@host>
where owner is the login name of the job owner, and host is the name of the host where it was run.
The Subject:
header contains the owner login name, hostname of the
server where the command was run and the command itself, in the
following format:
Cron <user@host> command
A copy of execution environment is included in the message in the form of
additional X-Cron-Env:
headers, each containing a single
environment variable.
The recipient of the message can be altered by setting the
MAILTO
, _JOB_MAILTO
, and _MICRON_MAILTO
variables in the crontab.
The MAILTO
variable is the traditional way of defining the
recipients for the job output. It affects all cronjobs in crontab
that appear after it, until next definition of any of the three
variables discussed, or end of the crontab file, whichever occurs
first. It is also reflected in the environment of the job itself.
See MAILTO.
If MAILTO
is unset, the default behavior (mailing to the owner)
is restored. If it is set to an empty string, cronjob output is
discarded.
Notice the difference:
MAILTO =
Restores default behavior.
MAILTO = ""
Discards the output.
The two built-in variables _JOB_MAILTO
and _MICRON_MAILTO
behave as MAILTO
, with the following differences:
The _JOB_MAILTO
variable, if set, affects only the cronjob that
immediately follows it. It is not reflected in the environment.
See _JOB_MAILTO.
The _MICRON_MAILTO
variable is rarely used. It works exactly as
MAILTO
, except that the actual value of the latter remains
unchanged. It is not reflected in the environment, either.
Next: Logging output to syslog, Up: Cronjob Output [Contents][Index]