Linux Fu: Troubleshooting Incron

Linux Fu: Troubleshooting Incron

You probably know about cron, a program that lets you schedule programs to run at various times. We’ve also talked about incron, which is very similar but instead of time, it reacts to changes in the file system. If you ever wanted to write a program that, say, detects a change in a file and automatically uploads it to a programmer, backs it up, e-mails it somewhere, or anything else, then incron might be for you. Although we’ve talked about it before, incron has some peculiarities that make it very difficult to debug problems, so I thought I’d share some of the tricks I use when working with incron.


I was thinking about this because I wanted to set up a simple system where I have a single document directory under git control. Changing a markdown file in that folder would generate Word document and PDF equivalents. Conversely, changing a Word document would produce a markdown version.


This is easy to do with pandoc — it speaks many different formats. The trick is running it only on changed files and as soon as they change. The task isn’t that hard, but it does take a bit to debug since it’s a bit nontrivial.

Incron Review


Setting up incron can be a bit of a pain. I’m going to assume you have a way to install it using a package manager like apt and that your system uses systemd to start and stop the service.


There’s more to it than that, though. You’ll need to be named in the /etc/incron.allow file (and not named in /etc/incron.deny). Once you are set up, it is pretty easy to use. Until it isn’t.


..

Support the originator by clicking the read the rest link below.