开发者

How do i monitor a directory creation on linux using ruby and get notified via email

开发者 https://www.devze.com 2023-01-03 16:14 出处:网络
so lets say i have a pre existing directories /source/version/1 , /source/version/2, /source/version/3

so lets say i have a pre existing directories /source/version/1 , /source/version/2, /source/version/3 I want to monitor if t开发者_JAVA百科here is a NEW directory created /source/version/4, and send an email if such directory is indeed created.


The Linux kernel subsystem that allows an application to receive notifications of file system changes, such as directory creation, is called inotify. There is a Ruby interface to inotify, but there doesn't seem to be much documentation available for it.

kfsmd is a daemon for monitoring file system changes (using inotify). It has a client that produces output to the console whenever a change occurs. You could pipe this output into your Ruby script and parse it.

0

精彩评论

暂无评论...
验证码 换一张
取 消