JYe9 / FileWatcher

FileWatcher is a simple Linux daemon that monitors file events using inotify and sends desktop notifications to the user. It can notify the user about file creations, deletions, accesses, writes and closes, modifications, and file movements.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FileWatcher - Linux System Files Status Monitor

FileWatcher is a simple Linux daemon that monitors file events using inotify and sends desktop notifications to the user. It can notify the user about file creations, deletions, accesses, writes and closes, modifications, and file movements.

Table of Contents

Features

  • Monitors specified file or directory for various file events.
  • Sends desktop notifications using libnotify on file events.
  • Gracefully handles shutdown signals for proper cleanup.

Prerequisites

  • Linux system with inotify support.
  • libnotify library for desktop notifications.

Installation

  1. Clone the repository or download the source code.
  2. Compile the code using a C compiler, for example:
    gcc -o filewatcher filewatcher.c -linotify -lnotify
  3. Run the compiled binary with the path of the file or directory to monitor as an argument.
  4. Recommend : Use the makefile to build the daemon

Usage

./filewatcher /path/to/monitor

Signal Handling

FileWatcher handles the following signals for proper cleanup:

  • SIGABRT
  • SIGINT
  • SIGTERM

When any of these signals is received, the daemon will remove the file from the inotify watch, close the inotify descriptors, and uninitialize the libnotify library before exiting.

Dependencies

  • inotify: Inotify system calls for monitoring file system events.
  • libnotify: GNOME library for sending desktop notifications.

References

Note: Ensure that you have the necessary permissions to access the files or directories being monitored. The daemon will display notifications for specified file events as they occur.

About

FileWatcher is a simple Linux daemon that monitors file events using inotify and sends desktop notifications to the user. It can notify the user about file creations, deletions, accesses, writes and closes, modifications, and file movements.

License:MIT License


Languages

Language:C 96.6%Language:Makefile 3.4%