Forge Home

cron

Yet another cron module

6,838 downloads

6,696 latest version

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

  • 0.1.1 (latest)
  • 0.1.0
released Nov 27th 2016
This version is compatible with:
  • Puppet Enterprise >=3.7.0 < 2015.3.0
  • Puppet >=3.3.0 <5.0.0
  • , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'jaxxstorm-cron', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install jaxxstorm-cron --version 0.1.1

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

jaxxstorm/cron — version 0.1.1 Nov 27th 2016

puppet-cron

Build Status

Table of Contents

  1. Module Description - What the module does and why it is useful
  2. Setup - The basics of getting started with puppet-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

Module description

This is yet another puppet-cron module. It will set up cron (by installed the package and making sure the service is running) and also includes a defined type which will put cron jobs in /etc/cron.d

The cron::job type can:

  • Set up locking, using flock, meaning cronjobs don't clobber each other
  • If you use sensu, alert when they fail, using sensu-wrapper

This module has some similarities to Yelp's puppet-cron with the intention of being much simpler while still providing some of the cool stuff in that module

Setup

What puppet-cron affects

  • puppet-cron will ensure the cronie or cron package is installed
  • It will may modify the permissions of several cron directories, like /etc/crond.d

Beginning with puppet-cron

Simply include the cron module like so:

  include ::cron

You may want to use a class include if you wish to override parameters:

  class { '::cron' :
        crond_dir => '/etc/cron'
  }

Usage

I just want to manage cron, what's the minimum I need

  include ::cron

I want to create a cron job

Use the cron::job defined type:

  ::cron::job {
    minute => '02',
    hour   => '1',
    lock   => true
  }

This will create a cronjob file in $crond_dir (default: /etc/cron.d) which will run on the schedule you specified.

Reference

Classes

Public Classes

  • cron: Installs and configures cron in your environment.
  • cron::job: Installs and configures a cronjob in $crond_dir

Private Classes

  • [cron::install]: Installs the required cron package
  • [cron::configure]: Configures cron's required directories
  • [cron::service]: Manages the cron service

cron

Parameters

package_name [String]

Specifies the package to install for cron

package_ensure [String]

Specifies the version of the cron package to install (default: os dependent)

service_name [String]

Specifies the cron service to manage (default: latest)

service_ensure [String]

Specifies the state of the cron service (running, stopped - default: running)

service_enable [Bool]

Specifies whether the crond service should be enabled on startup (true, false - default: true)

crontab_file [String]

Specifies the path to the OS crontab file (default: os dependent)

crond_dir [String]

Specifies the path to the cron.d dir (default: /etc/cron.d)

crond_hourly [String]

Specifies the path to the cron.hourly scripts directory (default: /etc/cron.hourly)

crond_weekly [String]

Specifies the path to the cron.weekly scripts directory (default: /etc/cron.weekly)

crond_monthly [String]

Specifies the path to the cron.monthly scripts directory (default: /etc/cron.monthly)

user [String]

Specifies the user to own the crond dirs and files (default: 'root' - CHANGE WITH CAUTION)

group [String]

Specifies the group to own the crond dirs and files (default: 'root' - CHANGE WITH CAUTION)

purge [Bool]

Specifies whether to purge the $crond_dir directory of jobs not specified by puppet (default: false)

cron::job

Parameters

command [String]

Specifies the command to run in the job (required)

ensure [String]

Specifies whether the job should exist or not (default: present)

minute [String]

Specifies the cron style minute the job should run (default: '*')

hour [String]

Specifies the cron style hour the should run (default: '*')

day_of_month [String]

Specifies the cron style day of the month the job should run (default: '*')

month [String]

Specifies the cron style montht the job should run (default: '*')

day_of_week [String]

Specifies the cron style day of the week the job should run (default: '*')

user [String]

Specifies the user the cron job should run as (default: 'root')

environment [Array]

Specifies an array of environment variables for the job in fhe format ENV=value (default: [])

lock [Bool]

Specifies whether the cron job should lock itself using flock (default: false)

monitor_job [Bool]

Specifies whether you want to monitor the job using sensu-wrapper (default: undef)

monitor_ttl [Integer]

Specifies a TTL for the job for sensu-wrapper (default: undef)

monitor_source [String]

Specifies a source string for the alert generated in sensu (default: undef)

monitor_timeout [Integer]

Specifies a timeout for sensu-wrapper before the job should halt and fail (default: undef)

Limitations