Live data from Hacker News

Watchman: Execute a command when something changes

github.com

81–90 of 98 posts

Re: Watchman: Execute a command when something changes

#83
post #49

I've been using fswatch to great effect. The big advantage is that it's truly cross-platform, falling back to polling if no fs notification system is available as long as stat(2) works. Very composable as you just pipe its output to whatever you want (typically a while read do end), so exclusion is a awk/sed/perl/grep/rg away, and command can be as simple or complex as it needs to while the tool itself stays lean. Co…

> If you are installing fswatch using a package manager and you would like the PDF manual to be bundled into the package, please send a feature request to the package maintainer. I can't find the PDF manual in the repo. Do I need to contact the author and say please?

Found it:

https://emcrisostomo.github.io/fswatch/doc/1.17.1/fswatch.pd...

Re: Watchman: Execute a command when something changes

#84
post #3

Not to be confused with Facebook’s file watch daemon, also names watchman, which does the same sort of thing but is more complicated. There’s a bunch of tools that integrate Facebook’s watchman for more efficient change tracking. Advantages of Facebook’s watchman: 1. Implements efficient file system event watches on macOS and Windows 2. IPC/daemon system reduces resource use because overlapping watches/triggers don’t…

PSA: it doesn't work on Ubuntu 22.04. I wanted to use it a few months ago, and it's not yet fixed.

Re: Watchman: Execute a command when something changes

#85
post #64

Does anybody have a good "execute a command when nothing changes" tool? I have some situations where I'd like to take action if, say, a file hasn't had its mtime updated in 24 hours.

Not sure if there's a way to do it instantly, but one way is to just run a find command in a cron job every X hours: find /foo/bar -type f -mtime +1 | xargs foobar

find's own exec option is usually good enough for most things:

-exec foobar {} +

Re: Watchman: Execute a command when something changes

#86
This post/share nerd-sniped me so bad. I went down a real rabbit hole reading about Linux inotify. The man pages are so well written. Example: https://man7.org/linux/man-pages/man7/inotify.7.html

I also found this Cygwin mailing list post by Erik Blake: https://cygwin.com/pipermail/cygwin/2018-May/237069.html

    And patches to make Cygwin support inotify_init() and friends implemented on top of the Windows native API are certainly welcome.
I think I just found my next personal project...

Re: Watchman: Execute a command when something changes

#88
post #3

Not to be confused with Facebook’s file watch daemon, also names watchman, which does the same sort of thing but is more complicated. There’s a bunch of tools that integrate Facebook’s watchman for more efficient change tracking. Advantages of Facebook’s watchman: 1. Implements efficient file system event watches on macOS and Windows 2. IPC/daemon system reduces resource use because overlapping watches/triggers don’t…

The Python integration seems to be abandoned unfortunately and isn’t keeping up with the parent. No longer works with django filewatching.

Re: Watchman: Execute a command when something changes

#89
post #3

Not to be confused with Facebook’s file watch daemon, also names watchman, which does the same sort of thing but is more complicated. There’s a bunch of tools that integrate Facebook’s watchman for more efficient change tracking. Advantages of Facebook’s watchman: 1. Implements efficient file system event watches on macOS and Windows 2. IPC/daemon system reduces resource use because overlapping watches/triggers don’t…

If you sign up for notifications on both github projects, you can watch the watchmen.

use facebook's watchman to watch changes to the source for OPs watchman to commit changes to the source of facebook's watchman to commit changes to OP's
Post reply on HN