Forge Home

cron

Manage cron

473,184 downloads

469,191 latest version

4.6 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

  • 2.2.0 (latest)
  • 2.1.1
released Feb 20th 2017
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 'ericsson-cron', '2.2.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install ericsson-cron --version 2.2.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

ericsson/cron — version 2.2.0 Feb 20th 2017

puppet-module-cron

Manage the cron configuration files.

  • /etc/crontab
  • /etc/cron.allow
  • /etc/cron.deny
  • /etc/cron.d/
  • /etc/cron.hourly
  • /etc/cron.daily
  • /etc/cron.weekly
  • /etc/cron.monthly
  • /etc/cron.yearly

===

Compatibility

This module has been tested to work on the following systems with Puppet v3 (with and without the future parser) and Puppet v4 with Ruby versions 1.8.7, 1.9.3, 2.0.0, 2.1.0 and 2.3.1.

  • EL 5
  • EL 6
  • SLES 10
  • SLES 11
  • SLES 12
  • Ubuntu 12

Note that SLES patches ISC's cron such that if cron.allow and cron.deny are both missing, then root will not be able to access the crontabs. This will cause errors. Please see the Hiera example below.

===

Class cron

Parameters

A value of 'undef' will use the defaults specified by the module.

package_ensure (string)

String for the ensure parameter for the cron package. Valid values are 'installed', 'present' and 'absent'.

  • Default: 'installed'

package_name (string or array)

Name of the cron package(s). Specify this to change the platform's default.

  • Default: 'USE_DEFAULTS'

crontab_path (string)

String for path to system wide crontab.

  • Default: '/etc/crontab'

crontab_owner (string)

Name of the owner of the crontab file.

  • Default: 'root'

crontab_group (string)

Name of the group of the crontab file.

  • Default: 'root'

crontab_mode (string)

Filemode of the crontab file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0644'

cron_allow (string)

If the file cron.allow exists, only users listed in it are allowed to use cron, and the cron.deny file is ignored. Valid values are 'present' and 'absent'.

  • Default: 'absent'

cron_deny (string)

If cron.allow does not exist, users listed in cron.deny are not allowed to use cron. Valid values are 'present' and 'absent'.

  • Default: 'present'

cron_allow_path (string)

Path to cron.allow.

  • Default: '/etc/cron.allow'

cron_allow_owner (string)

Name of the owner of the cron_allow file.

  • Default: 'root'

cron_allow_group (string)

Name of the group of the cron_allow file.

  • Default: 'root'

cron_allow_mode (string)

Filemode of the cron_allow file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0644'

cron_deny_path (string)

Path to cron.deny.

  • Default: '/etc/cron.deny'

cron_deny_owner (string)

Name of the owner of the cron_deny file.

  • Default: 'root'

cron_deny_group (string)

Name of the group of the cron_deny file.

  • Default: 'root'

cron_deny_mode (string)

Filemode of the cron_deny file. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0644'

cron_d_path (string)

Path to cron.d directory. Must be an absolute path.

  • Default: '/etc/cron.d'

cron_hourly_path (string)

Path to cron.d directory. Must be an absolute path.

  • Default: '/etc/cron.hourly'

cron_daily_path (string)

Path to cron.daily directory. Must be an absolute path.

  • Default: '/etc/cron.daily'

cron_weekly_path (string)

Path to cron.weekly directory. Must be an absolute path.

  • Default: '/etc/cron.weekly'

cron_monthly_path (string)

Path to cron.monthly directory. Must be an absolute path.

  • Default: '/etc/cron.monthly'

cron_dir_owner (string)

Name of the owner of the cron directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly.

  • Default: 'root'

cron_dir_group (string)

Name of the group of the cron.d directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly.

  • Default: 'root'

cron_dir_mode (string)

Filemode of the cron.d directories cron.d, cron.hourly, cron.daily, cron.weekly and cron.monthly. Must use the four-digit octal notation. RegEx: /^[0-9][0-9][0-9][0-9]$/

  • Default: '0755'

cron_files (hash)

Hash of files managed in cron.hourly, cron.daily, cron.weekly, cron.monthly and cron.yearly. See define cron::fragment for hash structure and examples for examples.

  • Default: undef

cron_allow_users (array)

Array of all users to be included in cron.allow.

  • Default: undef

cron_deny_users (array)

Array of all users to be included in cron.deny.

  • Default: undef

crontab_vars (hash)

Hash that defines the crontab variables SHELL, PATH, MAILTO, HOME. if this variable is undef the module will use the values defined in crontab template which are SHELL=/bin/bash, PATH=/sbin:/bin:/usr/sbin:/usr/bin, MAILTO=root, HOME=/

  • Default: undef

crontab_tasks (hash)

Hash for crontab tasks.

  • Default: undef

periodic_jobs_content (array or string)

Log entry lines for the periodic jobs section. One entry per line. Leave it unset (undef) to use the OS vendor defaults values.

  • Default: undef

periodic_jobs_manage (boolean)

Trigger to control if periodic jobs schedules should be included in /etc/crontab.

  • Default: true

service_enable (bool)

Boolean to enable the cron service.

  • Default: true

service_ensure (string)

String for the ensure parameter for the cron service. Valid values are 'running' and 'stopped'.

  • Default: 'running'

service_name (string)

Name of the cron service. Specify this to change the platform's default.

  • Default: 'USE_DEFAULTS'

Sample usage:

Work on Suse

Define crontab variables

Create /etc/cron.daily/daily_task

Manage /etc/cron.allow

Manage /etc/cron.deny

Manage /etc/crontab

Define cron::fragment

Parameters

ensure (string)

String for the ensure parameter of the cron fragment file. Valid values are 'absent', 'file' and 'present'.

  • Default: 'absent'

content (string)

String to represent contents of cron job.

  • Default: ''

owner (string)

Name of the owner of the fragment file.

  • Default: 'root'

group (string)

Name of the group of the fragment file.

  • Default: 'root'

mode (string)

Filemode of the fragment file. Must use the four-digit octal notation. RegEx: /^[0-7]{4}$/ By default it will depend on the used type parameter (see below). If type is set to 'd' it will set mode to '0644', in all other cases it will set mode to '0755'.

  • Default: 'USE_DEFAULTS'

type (string)

The type of cron job. This generally refers to "/etc/cron.${type}/". Valid values are 'd', 'hourly, 'daily', 'weekly', 'monthly' and 'yearly'.

  • Default: 'daily'