Follow

Is there an easy way of watching a file system tree & launching a command if something changes?

(it can be done in a 10 line shell script with inotify; is there a neat one-liner for this? or something that's more robust as a service?)

@marty @themactep @derp @onepict @alvin @JayT thanks everyone for the ideas! (a lot more to choose from now :))

@ssafar There's quite a few bash/python inotify implementations floating around, but my favorite for quick one-liner use is entr. [1]

Using it to watch e.g. a repository is as easy as `find . type -f -name "*.py" | entr -r python main.py` as an example of recursive watching,
but it can also fulfill some more complex needs if necessary.

[1] github.com/eradman/entr

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.