Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.
/ watchdog Public archive

A fast and minimal Lua module (written in C) that wraps the Linux `inotify` API.

License

Notifications You must be signed in to change notification settings

kayibea/watchdog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐾 watchdog

⚠️ Deprecated Repository

This library is no longer maintained. Development has moved to a new repository: kayibea/linotify

Please update your references and report issues there.

watchdog is a fast and minimal Lua module (written in C) that wraps the Linux inotify API


📦 Features

  • Thin native wrapper around inotify
  • Callback-based design (no busy loops)
  • Object-like instances for multiple watchers
  • Fully non-blocking poll() support
  • Includes all inotify constants

🔧 Installation

Via LuaRocks:

luarocks install watchdog
local signal = require("posix.signal")
local watchdog = require("watchdog")

local running = true

signal.signal(signal.SIGINT, function()
  print("\nShutting down...")
  running = false
end)

local wd = watchdog.init()

wd:add("/tmp", watchdog.IN_CREATE | watchdog.IN_DELETE, function(ev)
  print("Event:", ev.name, ev.mask)
end)

while running do
  wd:poll()
end

wd:close()

🧪 Testing

Run tests with Busted:

luarocks test

The test suite will create and remove temporary files in /tmp.

📄 License

MIT License — do whatever you want.

About

A fast and minimal Lua module (written in C) that wraps the Linux `inotify` API.

Topics

Resources

License

Stars

Watchers

Forks