有没有办法在 Linux 平台上以回调方式自动执行 perl 脚本?

有没有办法在 Linux 平台上以回调方式自动执行 perl 脚本?

我有一个 perl 脚本,它会在完成任务之前每 600 秒轮询一次文件是否存在。我使用 crontab 来安排我的脚本。我想知道 Linux 上是否有一个事件系统,我可以注册我的 perl 脚本,以便系统在文件存在时进行回调?

答案1

查看http://search.cpan.org/~mlehmann/Linux-Inotify2-1.2/Inotify2.pm(Linux::Inotify2——可扩展的目录/文件改变通知)。

另请查看因克龙

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. 

答案2

Inotify 应该是您的好帮手... 似乎还有 perl 绑定。不过您的内核需要支持它... 。

相关内容