Defined Type: cron::hourly

Defined in:
manifests/hourly.pp

Summary

This type creates an hourly cron job via a file in /etc/cron.d

Overview

Examples:

create a daily cron job with custom PATH environment variable

cron::hourly { 'generate_puppetdoc':
  minute      => '1',
  environment => [ 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"' ],
  command     => 'puppet doc >/var/www/puppet_docs.mkd',
}

Parameters:

  • command (Optional[String[1]]) (defaults to: undef)

    The command to execute.

  • ensure (Cron::Job_ensure) (defaults to: 'present')

    The state to ensure this resource exists in. Can be absent, present.

  • minute (Cron::Minute) (defaults to: 0)

    The minute the cron job should fire on. Can be any valid cron.

  • environment (Cron::Environment) (defaults to: [])

    An array of environment variable settings.

  • user (Cron::User) (defaults to: 'root')

    The user the cron job should be executed as.

  • mode (Stdlib::Filemode) (defaults to: '0600')

    The mode to set on the created job file.

  • description (Optional[String]) (defaults to: undef)

    Optional short description, which will be included in the cron job file.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'manifests/hourly.pp', line 16

define cron::hourly (
  Optional[String[1]] $command     = undef,
  Cron::Job_ensure    $ensure      = 'present',
  Cron::Minute        $minute      = 0,
  Cron::Environment   $environment = [],
  Cron::User          $user        = 'root',
  Stdlib::Filemode    $mode        = '0600',
  Optional[String]    $description = undef,
) {
  cron::job { $title:
    ensure      => $ensure,
    minute      => $minute,
    hour        => '*',
    date        => '*',
    month       => '*',
    weekday     => '*',
    user        => $user,
    environment => $environment,
    mode        => $mode,
    command     => $command,
    description => $description,
  }
}