Does anybody know of tool for Linux that can watch a custom subtree of the filesystem for changes, and executes a custom command when a change occurs ?

Such a tool would be very useful to quickly setup automatic building or uploading of source files.

link|improve this question
feedback

1 Answer

up vote 3 down vote accepted

You can use inotifywait from inotifytools:

This command simply blocks for inotify events, making it appropriate for use in shell scripts. It can watch any set of files and directories, and can recursively watch entire directory trees.

link|improve this answer
1  
Thanks, works perfectly. Wrapped in a loop: while [ TRUE ] ; do inotifywait -r . ; ./make.sh ; done – Tomas Sep 16 '10 at 10:49
1  
@Tomas: while true; do – grawity Sep 17 '10 at 14:25
Or for extreme brevity: while :; do – Dennis Williamson Sep 17 '10 at 14:53
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.