Forge Home

cron

Configure and manage cron jobs with focus on tidiness

26,086 downloads

88 latest version

5.0 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

  • 0.11.0 (latest)
  • 0.10.0
  • 0.9.0
  • 0.8.0
  • 0.7.0
  • 0.6.2
  • 0.6.1
  • 0.6.0
  • 0.5.0
  • 0.4.0
  • 0.3.0
  • 0.2.0
released Aug 1st 2024
This version is compatible with:
  • Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
  • Puppet >= 7.0.0 < 9.0.0

Start using this module

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

Add this module to your Puppetfile:

mod 'pegas-cron', '0.11.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add pegas-cron
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install pegas-cron --version 0.11.0

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

Documentation

pegas/cron — version 0.11.0 Aug 1st 2024

Configure and manage cron jobs with focus on tidiness

Build Status Puppet Forge Puppet Forge - Downloads Puppet Forge - Score

Table of Contents

  1. Description
  2. Setup - The basics of getting started with cron
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

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.

Setup

Beginning with cron

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!

Usage

Also manage /etc/cron.d directory

class { 'cron':
  purge_crond => true,
}

Same result through Hiera:

cron::purge_crond: true

Wipe it all out

class { 'cron':
  ensure => absent,
}

Same result through Hiera:

cron::ensure: absent

cron::job example

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 example

cron::whitelist { 'pkg_backup': }

This will make /etc/cron.d/pkg_backup immune, and keep the file's contents untouched.

Reference

Type Aliases

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

Full reference

Check out REFERENCE for up-to-date details.

Limitations

  • Made for and tested only on the following Ubuntu distributions:
    • 18.04
    • 20.04
    • 22.04
  • Custom Cron::* time types are a lot stricter than builtin cron ones. Careful - this may break existing cron jobs you are converting.
  • All cron jobs managed by built-in cron type are fair play. They won't be purged as long as they're in the catalog. But using this module's cron::job type does have its advantages.

Development

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.