Forge Home

anacron

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

9,035 downloads

8,679 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.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

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.

Download
Tags: cron, anacron

Documentation

gearboxscott/anacron — version 1.0.16 Mar 3rd 2016

gearboxscott-anacron

Description:

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.

##Usage:

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

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

Values:

  • 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:

rsync_templates:
  ensure: present
  command: foreman rsync -av -e ssh $SRC $DEST
  user: root
  minute: '*/30'
  environment:
  - 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.

Values:

  • 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:

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

Example 2:

tmpwatch:
  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?}
do
  if [ -d "$d" ]
  then
     /usr/sbin/tmpwatch "$flags" -f 30d "$d"
  fi
done

Notes

  • 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.

Support

License: Apache License, Version 2.0

GitHub URL: https://github.com/gearboxscott/gearboxscott-anacron