Automatically run a command every time a file is changed

Solution 1:

You don't say which Unix you're using, but Linux has inotify and there are inotify-tools and incron.

There is a Ruby interface to inotify.