Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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