File watchers. I always forget about those and never use then, but I constantly feel like I need them. So I made this list to stop searching everywhere for those things which are surprisingly hard to find in a search engine.

  1. Generic
    1. caretaker
    2. chokidar
    3. direvent
    4. entr
    5. fluffy
    6. fswatch
    7. gamin
    8. incron
    9. inoticoming
    10. inotify-hookable
    11. inotify-tools
    12. notify-rs
    13. peat
    14. systemd .path units
    15. watchexec
    16. watchman
  2. Web development
    1. grip (markdown)
    2. livereload
    3. frameworks
  3. Unit tests
    1. autotest
    2. conttest
    3. tdaemon
    4. Test::Continuous
  4. File synchronization
    1. gitwatch
    2. inosync
    3. lsyncd
  5. Intrusion detection
    1. fail2ban
    2. iwatch
    3. sshguard
  6. Other
    1. inotify-info
    2. kfmon (kobo launcher)
    3. timetrack

Generic

Those tools an watch files or trees of files and execute whatever.

caretaker

https://github.com/grego/caretaker

chokidar

https://github.com/kimmobrunfeldt/chokidar-cli

direvent

https://www.gnu.org.ua/software/direvent/

entr

http://eradman.com/entrproject/

fluffy

https://github.com/tinkershack/fluffy

fswatch

http://emcrisostomo.github.io/fswatch/

gamin

https://people.gnome.org/~veillard/gamin/

incron

https://github.com/ar-/incron

inoticoming

https://tracker.debian.org/pkg/inoticoming

inotify-hookable

https://metacpan.org/pod/App::Inotify::Hookable

inotify-tools

https://github.com/rvoicilas/inotify-tools/

notify-rs

https://github.com/notify-rs/notify

peat

https://github.com/sjl/peat

systemd .path units

https://www.freedesktop.org/software/systemd/man/systemd.path.html

Update: I tried to make this work for calibre but somehow it didn't work:

# this doesn't actually work. either it doesn't notices changes from git, or it
# doesn't notify calibre-server.service, or it does and that doesn't trigger a
# restart, but the thing doesn't restart as i would expect
[Path]
PathModified=/srv/books/metadata.db
PathModified=/srv/books
PathChanged=/srv/books/metadata.db
PathChanged=/srv/books

[Unit]
Description=calibre content server
After=network.target

... ie. it doesn't restart the service on changes to any of those files.

watchexec

https://github.com/watchexec/watchexec

watchman

http://facebook.github.io/watchman/

Web development

grip (markdown)

https://github.com/joeyespo/grip

livereload

https://github.com/lepture/python-livereload

frameworks

Many frameworks automatically reload files when they change. A few examples:

Unit tests

autotest

https://metacpan.org/pod/distribution/App-autotest/scripts/autotest

conttest

https://github.com/eigenhombre/continuous-testing-helper

tdaemon

https://github.com/brunobord/tdaemon

Test::Continuous

https://metacpan.org/pod/Test::Continuous

File synchronization

I will not go through a list of all the file synchronization tools here. Most of them have some sort of "wake-up" system to notify file changes, but they are considered out of scope here unless they can also launch custom commands. But just for the sake of the argument, I am aware of:

gitwatch

https://github.com/gitwatch/gitwatch

inosync

https://github.com/hollow/inosync

lsyncd

https://github.com/axkibe/lsyncd

Intrusion detection

Here again, there are many filesystem integrity checkers and intrusion detection systems (IDS), but they are not relevant here unless they can also execute arbitrary commands. But, again, here's an idea of the other stuff that is out there that might be a better fit than trying to fit a square peg in this round hole:

fail2ban

http://www.fail2ban.org/

iwatch

http://iwatch.sourceforge.net/

sshguard

https://sshguard.net/

Other

inotify-info

https://github.com/mikesart/inotify-info

kfmon (kobo launcher)

https://github.com/NiLuJe/kfmon

I've probably missed half a million such programs so this might be expanded with time and your comments.

Update: I've added a bunch of tools. I was relunctant to add all those old inotify wrappers because I don't find them as interesting as the newer ones - they're really hard to use! - but I guess it's worth mentioning them even if just to criticise them. ;)

timetrack

https://github.com/joshmcguigan/timetrack

Notify

You also have inotifywait/inotifywatch, inotify-hookable, lsyncd (can do more than just sync)

apt-cache show inotify-tools inotify-hookable lsyncd
Comment by Sytoka
comment 2
fail2ban (likewise sshguard, etc) is a file monitor too, though with a specific intention in mind. Bon soir.
Comment by Nick
Unit-Tests for Perl

Perl also has Continuous Testing features based in file monitoring. There are at least

Neither one seems to be in Debian stable, but they are only one cpanm call away.

Comment by mitch
You might like Fluffy

https://github.com/tinkershack/fluffy Not really meant for firing arbitrary commands, however it's output is super-'clean' & easy to parse. Also comes with a libfluffy library as well.

Comment by trx
Comments on this page are closed.
Created . Edited .