4 ms·
Show HN: Execute a shell command each time a given file or directory changes
- kseistrup 13y agoI'm aware that it's beyond the scope of cel, but I'd use incron anyday for jobs like this.
- dinduks 13y agoInotify is specific to Linux, while CEL isn't OS dependent.
- osth 13y agoExcept if you account for the fact that some other UNIX-like OS do not use bash as /bin/sh. You could even say that using bash as /bin/sh "is specific to Linux." How to fix: /#!\/bin\/bash/s/bash/sh/
- stephenr 13y agoA better approach surely would be to wrap inotify/osx fsevents
- lotsofcows 13y agoThat's what incron does...
- stephenr 13y agoOn Linux yes, it doesn't exist on osx though. My point was that the author could have written his tool as cross platform without relying on an 'ls' every 100ms, by using the platform tools availble
- deleted 13y ago[deleted]
- shabble 13y agoI'm sure I've seen a nicely crossplatform command-line tool for this, but I can't seem to find it. The closest (by support for non-poll APIs) seems to be 'simplefilewatcher'[1], but that's just a C++ library. incron, inotify, filewatcher[2], puncher[3], guard[4] are a bunch of existing ones, but they're all either not entirely functional cross-platform, or require some faffing with dependencies to get working. [1] https://code.google.com/p/simplefilewatcher/ https://code.google.com/p/simplefilewatcher/ [2] https://github.com/thomasfl/filewatcher https://github.com/thomasfl/filewatcher [3] http://rawsyntax.com/blog/puncher-the-simple-file-watcher-for-os-x/ http://rawsyntax.com/blog/puncher-the-simple-file-watcher-fo... [4] https://github.com/guard/guard https://github.com/guard/guard