Defined Type: incron::job

Defined in:
manifests/job.pp

Overview

Primary incron resource used to create incron jobs.

Examples:

Using incron::job resource

incron::job { 'process_file':
  path    => '/upload',
  event   => 'IN_CLOSE_WRITE',
  command => '/usr/bin/process_file $#',
}

Parameters:

  • command (String[1])

    Command to execute on triggered event

  • event (Variant[Incron::Event, Array[Incron::Event, 2]])

    inotify event (or an array of events)

  • path (Stdlib::Unixpath)

    Path to watched directory

  • user (String[1]) (defaults to: 'root')

    User that owns incron job



14
15
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/job.pp', line 14

define incron::job (
  String[1]                  $command,
  Variant[Incron::Event,
    Array[Incron::Event, 2]] $event,
  Stdlib::Unixpath           $path,
  String[1]                  $user = 'root',
) {

  include ::incron

  if !defined(Concat["/var/spool/incron/${user}"]) {
    concat { "/var/spool/incron/${user}":
      ensure => present,
      mode   => '0600',
      owner  => $user,
      group  => 'incron',
    }
  }

  concat::fragment { "incron_${title}":
    target  => "/var/spool/incron/${user}",
    content => "${path} ${join(any2array($event), ',')} ${command}\n",
  }

}