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.
New in version 0.17.0.
Verifies that the specified incron job is absent for the specified user; only the name is matched when removing a incron job.
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.
Docs for previous releases are available on salt.rtfd.org.
Latest Salt release: 2014.7.1
22.27.40. salt.states.htpasswd
22.27.42. salt.states.influxdb_database
Upcoming SaltStack events, webinars and local meet ups and user groups.