Skip to content

dcasella/watchd

Repository files navigation

watchd

A fearlessly concurrent filesystem watcher daemon.
Watch for file or directory changes (content, permissions) and execute commands.

Build

Install a Rust toolchain with Cargo.
rustup may help with that.

Build on Debian

Install cargo-deb and use the Makefile:

cargo install cargo-deb
make deb

The .deb file will be in the ./releases directory.

Build on RHEL

Install cargo-rpm and use the Makefile:

cargo install cargo-rpm
make rpm

The .rpm file will be in the ./releases directory.

Install

Install on Debian

Build it first, then:

dpkg -i ./releases/watchd....deb

Install on RHEL

Build it first, then:

rpm -i ./releases/watchd....rpm

Configuration

The default configuration does a decent job at explaining things; this is just a Markdownification of it.

Global

log-file

Duplicate stdout logs to the specified file.

Default: None

Example:

log-file = "/var/log/watchd.log"

dry-run

Log commands without executing.

Default: false

Example:

dry-run = true

init

Execute commands on program start.

Default: false

Example:

init = true

verbose

Increment log verbosity.

Default: false

Example:

verbose = true

entry sections

File or directory to watch.
Multiple entries allowed.

path

Path to watch.

  • String
  • Required
  • Must be a valid filesystem path
recursive

Watch path and its subdirectories.

  • Boolean
  • Default: false
delay

Time between the last received event and the command to execute.

  • Float64
  • Default: 0.0
  • Must be non-negative
exclude

List of patterns to ignore.
Syntax: docs.rs.

  • []String
  • Default: []
  • Must be valid regular expressions
  • Backslashes must be escaped
command
  • []String
  • Required
  • Commands are executed via $(sh -c "${command}")