Forge Home


This module will help create anacron entries to schedule programs, scripts, etc. on Linux systems that support anacron.


8,464 latest version

3.3 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.0.16 (latest)
  • 1.0.15 (deleted)
  • 1.0.14 (deleted)
  • 1.0.13 (deleted)
  • 1.0.12 (deleted)
released Mar 3rd 2016
This version is compatible with:

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'gearboxscott-anacron', '1.0.16'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gearboxscott-anacron
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gearboxscott-anacron --version 1.0.16

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Tags: cron, anacron


gearboxscott/anacron — version 1.0.16 Mar 3rd 2016



This module will help create anacron entries to schedule programs, scripts, etc. on Linux systems that support anacron.

Using Anacron on Servers

Anacron was originally put in place for workstations and servers that were not constantly powered on. Anacron on servers that are powered on permanently can be a powerful scheduling resource. It can reduce the number crontab entries and makes it easier to find scheduled programs and script because schedule is file based not entry based.

About gearboxscott-anacron

gearboxscott-anacron will manage anacron. It will manage entries in:

  • /etc/cron.d

or files in directories:

  • /etc/cron.hourly
  • /etc/cron.daily
  • /etc/cron.weekly
  • /etc/cron.yearly

gearboxscott-anacron supports smart-parameters for Foreman and hiera.


Include the system module in your puppet configuration (non-foreman):

include anacron

and add hiera configuration. In foreman's add the anacron to the puppet repostory, publish and in the puppet section, go to anacron and edit the smart parameters. The variable type will be hash or yaml to be like hiera.


jobs is the only class that uses a template to create the /etc/cron.d/somefile.


  • ensure: present or absent (default: present)
  • user: username (default: root)
  • date: day of the month, 1-31 (default: '*')
  • month: month of the year, 1-12 or names (default: '*')
  • weekday: day number of the week, 0-7 or names (0 or 7 is Sunday, or use names) (default: '*')
  • hour: 0-23 (default: '*')
  • minute: 0-59 (default: '*')

Example 1 - rsync's the templates to another puppet master every 30 minutes. A file named rsync_templates will be created in /etc/cron.d/ and will have the following contents:

*/30 * * * * foreman rsync -av -e ssh /var/lib/puppet/templates root@somepuppetmaster

Here is the hash:

  ensure: present
  command: foreman rsync -av -e ssh $SRC $DEST
  user: root
  minute: '*/30'
  - MAILTO=root
  - PATH="/usr/bin:bin"
  - DEST="root@somepuppetmaster"
  - SRC="/var/lib/puppet/templates"

hourly, daily, weekly, monthly

hourly, daily, weekly, or monthly will create a file from template or link in /etc/cron.d/hourly, /etc/cron.d/daily, /etc/cron.weekly or /etc/cron.monthly respectively.

All the modules act the same way.


  • ensure: absent or present
  • type: can be either link or template.
  • script: name of file to link or template file to use to create a file.

Example 1: Using anacron::daily module or dailies:

  ensure: present
  type: link
  script: /usr/local/sbin/capture_daily_metrics

Example 2:

  ensure: present
  type: template
  script: /var/lib/puppet/templates/cron.daily/tmpwatch.erb

The template /var/lib/puppet/templates/cron.daily/tmpwatch.erb:

for d in /var/var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}
  if [ -d "$d" ]
     /usr/sbin/tmpwatch "$flags" -f 30d "$d"


  • Do not specify resources that are managed by other Puppet modules otherwise you will get conflict errors.

  • As with many default types you can often specify a 'target' parameter to specify a different configuration filename or value to change.


License: Apache License, Version 2.0

GitHub URL: