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.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'manifests/job.pp', line 21

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["${incron::spool_dir}/${user}"]) {
    concat { "${incron::spool_dir}/${user}":
      ensure => present,
      mode   => '0600',
      owner  => $user,
    }
  }

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