我有一个perl脚本,在每个600秒内轮询文件的存在,然后继续完成任务。 我正在使用crontab来安排我的脚本。 我不知道是否有一个事件系统在Linux上,我可以注册我的Perl脚本,以便系统做callback,如果该文件存在?
查看http://search.cpan.org/~mlehmann/Linux-Inotify2-1.2/Inotify2.pm(Linux :: Inotify2 – 可扩展的目录/文件更改通知)。
还检查出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应该是你的朋友… …。 似乎也有perl绑定。 你的内核需要支持这个,虽然…。