kamal
kamal

Reputation: 9785

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

so lets say i have a pre existing directories /source/version/1 , /source/version/2, /source/version/3 I want to monitor if there is a NEW directory created /source/version/4, and send an email if such directory is indeed created.

Upvotes: 0

Views: 374

Answers (1)

mikej
mikej

Reputation: 66263

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.

Upvotes: 1

Related Questions