# salt.states.incron

## Management of incron, the inotify cron

The incron state module allows for user incrontabs to be cleanly managed.

Incron declarations require a number of parameters. The parameters needed to be declared: `path`, `mask`, and `cmd`. The `user` whose incrontab is to be edited also needs to be defined.

When making changes to an existing incron job, the `path` declaration is the unique factor, so if an existing cron that looks like this:

    Watch for modifications in /home/user:
        incron.present:
            - user: root
            - path: /home/user
            - mask:
                - IN_MODIFY
            - cmd: 'echo "$$ $@"'

Is changed to this:

    Watch for modifications and access in /home/user:
        incron.present:
            - user: root
            - path: /home/user
            - mask:
                - IN_MODIFY
                - IN_ACCESS
            - cmd: 'echo "$$ $@"'

Then the existing cron will be updated, but if the cron command is changed, then a new cron job will be added to the user's crontab.

Added in version 0.17.0.

salt.states.incron.absent(name, path, mask, cmd, user='root')

  Verifies that the specified incron job is absent for the specified user; only the name is matched when removing a incron job.

  name

    Unique comment describing the entry

  path

    The path that should be watched

  user

    The name of the user who's crontab needs to be modified, defaults to the root user

  mask

    The mask of events that should be monitored for

  cmd

    The cmd that should be executed

salt.states.incron.present(name, path, mask, cmd, user='root')

  Verifies that the specified incron job is present for the specified user. For more advanced information about what exactly can be set in the cron timing parameters, check your incron system's documentation. Most Unix-like systems' incron documentation can be found via the incrontab man page: `man 5 incrontab`.

  name

    Unique comment describing the entry

  path

    The path that should be watched

  user

    The name of the user who's crontab needs to be modified, defaults to the root user

  mask

    The mask of events that should be monitored for

  cmd

    The cmd that should be executed