Cron resources
Cron is the mechanism on Unix-like systems which runs scheduled jobs, sometimes known as batch jobs, at specified times or intervals. For example, system housekeeping tasks, such as log rotation or checking for security updates, are run from cron. The details of what to run and when to run it are kept in a specially formatted file called crontab
(short for cron table).
Puppet provides the cron
resource for managing scheduled jobs, and we saw an example of this in the run-puppet
manifest we developed in Chapter 3, Managing your Puppet code with Git (run-puppet.pp
):
cron { 'run-puppet': command => '/usr/local/bin/run-puppet', hour => '*', minute => '*/15', }
The title run-puppet
identifies the cron job (Puppet writes a comment to the crontab
file containing this name to distinguish it from other manually-configured cron jobs). The command
attribute specifies the command for cron to run, and the hour
and minute
specify...