I have a perl script that does polling a file's existence in every 600 seconds before it goes on to finish its task. I am using crontab to schedule my script. I wonder is there an event system on linux that I could register my perl script so that system does the call-back if the file exists?


Check out http://search.cpan.org/~mlehmann/Linux-Inotify2-1.2/Inotify2.pm (Linux::Inotify2 - scalable directory/file change notification).

Also check out incron

It consists of a daemon and a table manipulator. You can use it a similar way as the 
regular cron. The difference is that the inotify cron handles filesystem events rather 
than time periods. 

Inotify should be your friend for this one... . There seem to be perl bindings as well. Your kernel needs to support this though... .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy