Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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.
share|improve this answer

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

share|improve this answer

Your Answer

 
discard

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