Results 1 to 4 of 4
I'm writing a program (something like an antivirus) which scans files.
it is running with cron every minute and finds files modified in past 1 minute (with find command) then ...
- 11-20-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 5
modified files
I'm writing a program (something like an antivirus) which scans files.
it is running with cron every minute and finds files modified in past 1 minute (with find command) then starts its work on found files, it works nicely and does what I expect but the problem is that it is a bit heavy because find command is not so fast (and needs a lot of resources) and also it might take to a minute for a file to be scanned
I would like to know if there is a way to run a command on every file whenever it is modified, I mean
whenever a file is modified, a command runs on it, is it possible to do such a thing in Linux?
- 11-20-2010 #2
inotify may work for you, or more specific incrond.
I use it on production backend systems inotify - get your file system supervised
If you are on a redhat based distro, then it is available from EPEL
EPEL - FedoraProject
Or you choose to build your own RPM, to not mix dependencies between centos/redhat and the epel repositories.Last edited by Irithori; 11-20-2010 at 10:13 AM.
You must always face the curtain with a bow.
- 11-20-2010 #3Just Joined!
- Join Date
- Nov 2010
- Posts
- 5
Thanks a lot, that was exactly what I was looking for
- 11-20-2010 #4
Have fun

Alternatively, I just found iWatch
iWatch
It might be a little harder to package due to perl dependencies
Linux::Inotify2, Event, Mail::Sendmail and XML::Simple.
On the good side, you gain more features compared to the simple incrond.
Most noteable the ability to
- watch a directory recursively
- exclude directories and files via regex
- match files via regexLast edited by Irithori; 11-20-2010 at 01:04 PM.
You must always face the curtain with a bow.


Reply With Quote