The expectation was that there would be a mailto
attribute, but the this source denies that
cron { 'resource title': name => # (namevar) The symbolic name of the cron job. This name is ensure => # The basic property that the resource should be... command => # The command to execute in the cron job. The... environment => # Any environment settings associated with this... hour => # The hour at which to run the cron job. Optional; minute => # The minute at which to run the cron job... month => # The month of the year. Optional; if specified... monthday => # The day of the month on which to run the... provider => # The specific backend to use for this `cron... special => # A special value such as 'reboot' or 'annually'... target => # The name of the crontab file in which the cron... user => # The user who owns the cron job. This user must... weekday => # The weekday on which to run the command... # ...plus any applicable metaparameters. }
The docs does not indicate if mailto is supported, e.g.:
environment
(Property: This attribute represents concrete state on the target
system.)Any environment settings associated with this cron job. They will be
stored between the header and the job in the crontab. There can be no
guarantees that other, earlier settings will not also affect a given
cron job.Also, Puppet cannot automatically determine whether an existing,
unmanaged environment setting is associated with a given cron job. If
you already have cron jobs with environment settings, then Puppet will
keep those settings in the same place in the file, but will not
associate them with a specific job.Settings should be specified exactly as they should appear in the
crontab, e.g., PATH=/bin:/usr/bin:/usr/sbin.
Best Answer
The built-in Puppet type
cron
as referenced in the question has a property namedenvironment
that can be used to set environment variables for the managed cronjob.In this case it would look like this, setting the
MAILTO
variable tofoobar
so that output of the cronjob will be mailed to userfoobar
: