How do I run a script every time I save a file in Linux?
+8
A:
Linux has a subsystem call inotify which can cause filesystems to report changes in the filesystem to applications.
Your linux system probably has a package called incron
which makes using inotify
very easy. (Or search your available packages for any package whose description contains the word 'inotify').
Setting up incron
is very much like setting up cron
, except whereas cron
executes a script at a specified time and date, incron
executes a script whenever a specified file or directory changes.
PS. On Ubuntu (for example), incron
is this package and is installed with
sudo apt-get install incron
unutbu
2010-07-06 18:28:26