All Projects → devilbox → watcherd

devilbox / watcherd

Licence: MIT license
A shell daemon that will listen for directory changes and execute custom commands for each event.

Programming Languages

shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to watcherd

fswatch
File/Directory Watcher for Modern C++
Stars: ✭ 56 (+16.67%)
Mutual labels:  inotify, watcher
Inotify Tools
inotify-tools is a C library and a set of command-line programs providing a simple interface to inotify.
Stars: ✭ 2,447 (+4997.92%)
Mutual labels:  inotify, inotifywait
gowatch
watch go files for developer, support run test case and auto reload server application
Stars: ✭ 18 (-62.5%)
Mutual labels:  inotify, watcher
Trigger
Run a user-defined command on file changes
Stars: ✭ 163 (+239.58%)
Mutual labels:  inotify
Hupper
in-process file monitor / reloader for reloading your code automatically during development
Stars: ✭ 167 (+247.92%)
Mutual labels:  inotify
github-actions-watcher
A CLI tool to see the status of your all GitHub Actions workflows in real time
Stars: ✭ 111 (+131.25%)
Mutual labels:  watcher
Dfs
A distributed file server framework based on swoole and inotify
Stars: ✭ 112 (+133.33%)
Mutual labels:  inotify
vue-scrollwatch
scrollspy
Stars: ✭ 59 (+22.92%)
Mutual labels:  watcher
myoddweb.directorywatcher
A fast and reliable, (non blocking!), .NET/C++ File/Directory watcher, complete rewrite of FileSystemWatcher to ensure speed/accuracy/reliability/suppress duplicate events.
Stars: ✭ 41 (-14.58%)
Mutual labels:  watcher
Dogo
Monitoring changes in the source file and automatically compile and run (restart).
Stars: ✭ 237 (+393.75%)
Mutual labels:  inotify
pmOCR
A wrapper for tesseract / abbyyOCR11 ocr4linux finereader cli that can perform batch operations or monitor a directory and launch an OCR conversion on file activity
Stars: ✭ 53 (+10.42%)
Mutual labels:  inotify
Node Inotify
Inotify bindings for Node.JS
Stars: ✭ 237 (+393.75%)
Mutual labels:  inotify
Inotify
Idiomatic inotify wrapper for the Rust programming language
Stars: ✭ 175 (+264.58%)
Mutual labels:  inotify
taskctl
Concurrent task runner, developer's routine tasks automation toolkit. Simple modern alternative to GNU Make 🧰
Stars: ✭ 237 (+393.75%)
Mutual labels:  watcher
Minotaur
A pythonic, asynchronous, inotify interface
Stars: ✭ 163 (+239.58%)
Mutual labels:  inotify
inotify-rs
Idiomatic inotify wrapper for the Rust programming language
Stars: ✭ 219 (+356.25%)
Mutual labels:  inotify
Clsync
file live sync daemon based on inotify/kqueue/bsm (Linux, FreeBSD), written in GNU C
Stars: ✭ 115 (+139.58%)
Mutual labels:  inotify
lua-watcher
👀 A Lua module to monitor files from a specific directory
Stars: ✭ 16 (-66.67%)
Mutual labels:  watcher
pwatch
Process watcher(pwatch)
Stars: ✭ 33 (-31.25%)
Mutual labels:  watcher
rorshach
A watchman for your directories. Rorshach allows you to listen to file system changes and run commands when these events occur.
Stars: ✭ 26 (-45.83%)
Mutual labels:  watcher

watcherd

tag linting test-linux test-macos test-windows

watcherd will look for directory changes (added and deleted directories) under the specified path (-p) and will execute specified commands or shell scripts (-a, -d) depending on the event. Once all events have happened during one round (-i), a trigger command can be executed (-t). Note, the trigger command will only be execute when at least one add or delete command has succeeded with exit code 0.


If you need the same functionality to monitor changes of listening ports, check out watcherp.


Modes

watcherd can either use the native inotifywait implementation or if this is not available on your system use a custom bash implementation. The default is to use bash.

Placeholders

There are two placeholders available that make it easier to use custom commands/scripts for the add (-a) or delete (-d) action.:

  • %p Full path to the directory that was added or deletd
  • %n Name of the directory that was added or deleted

You can specify the placeholders as many times as you want. See the following example section for usage.

Examples

By using vhost_gen.py (which is capable of creating Nginx or Apache vhost config files for normal vhosts or reverse proxies), the following will be able to create new nginx vhosts on-the-fly, simply by adding or deleting folders in your main www directory. The trigger command will simply force nginx to reload its configuration after directory changes occured.

# %n will be replaced by watcherd with the new directory name
# %p will be replaced by watcherd with the new directory path
watcherd -v \
  -p /shared/httpd \
  -a "vhost_gen.py -p %p -n %n -s" \
  -d "rm /etc/nginx/conf.d/%n.conf" \
  -t "nginx -s reload"

Usage

Usage: watcherd -p <path> -a <cmd> -d <cmd> [-t <cmd> -w <str> -i <int> -v]
       watcherd --help
       watcherd --version

watcherd will look for directory changes (added and deleted directories) under
the specified path (-p) and will execute specified commands or shell scripts
(-a, -d) depending on the event. Once all events have happened during one round
(-i), a trigger command can be executed (-t). Note, the trigger command will
only be execute when at least one add or delete command has succeeded with exit
code 0.

Required arguments:
  -p <path>     Path to directoy to watch for changes.
  -a <cmd>      Command to execute when a directory was added.
                You can also append the following placeholders to your command string:
                %p The full path of the directory that changed (added, deleted).
                %n The name of the directory that changed (added, deleted).
                Example: -a "script.sh -f %p -c %n -a %p"
  -d <cmd>      Command to execute when a directory was deletd.
                You can also append the following placeholders to your command string:
                %p The full path of the directory that changed (added, deleted).
                %n The name of the directory that changed (added, deleted).
                Example: -d "script.sh -f %p -c %n -a %p"

Optional arguments:
  -t <cmd>      Command to execute after all directories have been added or
                deleted during one round.
                No argument will be appended.
  -w <str>      The directory watcher to use. Valid values are:
                'inotify': Uses inotifywait to watch for directory changes.
                'bash':    Uses a bash loop to watch for directory changes.
                The default is to use 'bash' as the watcher.
  -i <int>      When using the bash watcher, specify the interval in seconds
                for how often to look for directory changes.
  -v            Verbose output.

Misc arguments:
  --help        Show this help screen.
  --version     Show version information.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].