Watch a file or directory and execute a command when it changes.
Proximity is a tiny program that executes a command when a file or directory has changed. I use it to run a build script when I modify the source for a project I'm working on.
Proximity requires node.js and npm. Once you have these dependencies, simply:
npm install proximity -g
The first argument after
proximity is the command to run. All following arguments are paths to watch.
For example, the following command will run
./build.sh && ps aux | grep node whenever server.js or static/ are changed.
proximity "./build.sh && ps aux | grep node" server.js static/
Proximity should only be used to run commands that will exit at some point because a separate child process is spawned on each change detected.