2

Puppet has the cron resource for managing the crontab, but is there a similar way of managing incrontab? I can find no writings anywhere regarding this, and to be fair, I'm extremely new to puppet (software dev helping out an overworked sysadmin).

Josh Smeaton
  • 1,330
  • 2
  • 19
  • 31

2 Answers2

3

There is no native support for incron but that doesn't mean you can't write a simple defined type that manages the tabs in /etc/incron.d. These would be just file resources for which Puppet has of course native support. Depending on your specific needs you could also make that defined type more complex by adding support for per-user incrontabs. These would probably require use of the Concat module.

But have a look at https://puppet.com/docs/puppet/latest/lang_defined_types.html first for more info on defined types. Could be that's all you need.

рüффп
  • 620
  • 1
  • 11
  • 24
daff
  • 4,729
  • 2
  • 26
  • 27
  • excuse my ignorance, but I have an incron line added to the incrontab, but nothing at all in /etc/incron.d/ .. if a file with a single line is added to the incron.d folder, should it load up as an incrontab ? – Josh Smeaton Sep 28 '12 at 07:05
  • 1
    Yes, system incrontabs are loaded and watched by `incrond`. I don't personally use or know much of incron, I just read http://linux.die.net/man/5/incrontab which states that system incrontabs are in `/etc/incron.d` and user incrontabs are created by means of incrontab and put in `/var/spool/incron`. So your Puppet type/module would put system incrontabs in `/etc/incron.d` and a user's incrontab in `/var/spool/incron/`. – daff Sep 28 '12 at 08:51
1

I've found a incron module at https://github.com/duritong/puppet-incron.

I have a pending pull request that adds a incron::watch defined type. It's working fine for me so far.

amontero
  • 11
  • 1