Live data from Hacker News

Watchman: Execute a command when something changes

github.com

61–70 of 98 posts

Re: Watchman: Execute a command when something changes

#63

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.

Does it need to be precise? I'd probably just use an hourly cron job.

Re: Watchman: Execute a command when something changes

#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

Re: Watchman: Execute a command when something changes

#66
post #4

For those use-cases I use entr ( https://github.com/clibs/entr ). In what sense does watchman differ to it? Didn't see anything related to this at first glance :-)

The page linked above says: > WARNING: This is a (possibly outdated and/or unmaintained) fork of https://github.com/eradman/entr .

[deleted]

Re: Watchman: Execute a command when something changes

#68
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…

Alternately, Facebook's project is not to be confused with this significantly older one.

Re: Watchman: Execute a command when something changes

#70
Shameless plug for my own take on file watchers. The filewatcher command line utility is available as a ruby gem. It exports shell variables, so you can print name of files that changes this way: $ filewatcher *.js 'echo $FILENAME'

It recently reached 1 million downloads. The current maintainer, Alex Popov, is a very skilled developer working from Moscow.

Post reply on HN