Home   →   Blog   →   File Activity Monitoring on Linux OS

File Activity Monitoring on Linux OS

There are many tasks within web development, that actively interact with the file system in order to monitor chages of files and catalogs. In order to solve these tasks it is necessary to provide the processing of the immediate file changes that should be performed with the minimal resource consumption. The DropBox service might be a nice example of such type of applications. It has to process all the changes inside the assigned catalog – immediately and consuming the minimum of resources.

Lets imagine we need to develop an application (or a website) like DropBox that should be running on Linux OS. Traditionally this kind of the project consists of two subsystems – server and client subsystem.

Server subsystem regularly tracks and authorizes users, provides synchronization of file changes, conflict solution or file exporting, etc.

Client subsystem provides a limited way to access file information, tracks user interaction and informs the server about them. The key problem of the this application is to provide immediate way to inform client subsystem about file changes.

 Requirements for this subsystem:

- Immediate processing of changes.

- Minimum of resources consumed.

- Monitoring of such operations as file movement and renaming, and others that do not lead to data modification in certain files but change the structure.

Initial approach is the checking of the file system with the using file checksums. In order to do this we have to visit every element in the targeted catalog, then to find out its data (attribute, checksum, etc.) and to make a conclusion about the change in the required catalog. At first, when an application is beeing developed such an operation might be worthwhile, but then such polling consumes too much resources and might complicate server administration. That is why it is necessary to use some automated solution that would operate only in the case of available changes. For the Linux OS it would be Inotify.

Inotify is the subsystem of the Linux kernel which monitors file system changes and sends associated events to necessary applications instantly (data deletion, reading, recording, and even unmount). Among others it is also possible to monitor start and end moving points.

Inotify raises events:

  1. IN_ACCESS The most minimal file event
  2. IN_ATTRIB Metadata change
  3. IN_CLOSE_WRITE A file that was opened for recording — closed
  4. IN_CLOSE_NOWRITE A file that was opened not for recording — closed
  5. IN_CREATE Creating a file/directory
  6. IN_DELETE Deleting a file/directory
  7. IN_DELETE_SELF Deleting a file/directory that is a “viewpoint”
  8. IN_MODIFY Changing a file
  9. IN_MOVE_SELF Changing a file/directory that is a “viewpoint”
  10. IN_MOVED_FROM File movement from a monitor catalog out of a certain monitoring area
  11. IN_MOVED_TO File movement from a certain area to the monitor catalog
  12. IN_OPEN Opening a file

We suggest using this approach to resolve such kind of issues. 

Please follow us on:

If you have any questions or would like to contact us about possible request on design or mobile friendly websites/mobile apps development please use Contact form.

Next Posts
00bed15b93a7414d8325a4f9dd5becbe9c953ef4 Gambling and Slots Mobile Apps
Thanks to mobile gambling now any of casino game could be in your mobile device. Many online casinos offer mobile version of gambling today. Real money gambling apps give you the opportunity to play your favorite casino anywhere and anytime.
53931284ad675d62932e2d26457249058d87eb91 Choosing Between Native vs. Web vs. Hybrid App
Business owners considering mobile apps development may choose among three options of apps – native, web or hybrid applications.
84747a54d4a5a9a93deaf9e68469ec8f3853bedb The Importance of Product Design for Mobile and Web Apps
In today's tech industry, product design has become a victim of misconceptions and wrong interpretations. Many often boil this concept down to interfaces and icons, not realising its complexity and importance for product development. In this article, we w
Notice Our website uses cookies, which are necessary for its functioning and required to achieve the purposes illustrated in the privacy policy. By closing this banner you agree to the use of cookies.