This module is an interface for cron jobs with the main idea to be tidy. That means that any jobs that are not managed
should not exist. Once you switch all cron jobs to this module, simply removing the definition is sufficient without
worrying about setting ensure => disable
and waiting for changes to propagate.
To start out with cron:
include cron
This will start purging all unmanaged cron resources and also make sure the 'cron' package is installed and the service is running.
WARNING: All existing unmanaged cron jobs will be purged!
class { 'cron':
purge_crond => true,
}
Same result through Hiera:
cron::purge_crond: true
class { 'cron':
ensure => absent,
}
Same result through Hiera:
cron::ensure: absent
cron::job { 'backup':
user => 'backup', # default: 'root'
minute => '3-59/5',
hour => '9-17',
monthday => '*/2',
month => [ 4, 8, 12 ],
weekday => '0-4',
}
cron::whitelist { 'pkg_backup': }
This will make /etc/cron.d/pkg_backup
immune, and keep the file's contents untouched.
Cron::Command
- Used for cron::job::command
parameter. Does not allow newline characters (which breaks crontab).Cron::User
- Match username to fail early if invalid username is provided.Cron::Minute
- Stricter cron::job::minute
.Cron::Hour
- Stricter cron::job::hour
.Cron::Monthday
- Stricter cron::job::monthday
.Cron::Month
- Stricter cron::job::month
.Cron::Weekday
- Stricter cron::job::weekday
.Check out REFERENCE for up-to-date details.
Cron::*
time types are a lot stricter than builtin cron
ones. Careful - this may break existing cron jobscron
type are fair play. They won't be purged as long as they're in the catalog.cron::job
type does have its advantages.I'll be happy to know you're using this for one reason or the other. And if you want to contribute - even better. Feel free to submit an issue / fire up a PR / whatever.