Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ Note, the trigger command will only be execute when at least one add or delete c

watcherd can either use the native [inotifywait](https://linux.die.net/man/1/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

Assuming `vhost-add.sh` will add nginx vhost config files and `vhost-del.sh` will remove nginx vhost config files, the following will then 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.
Assuming [vhost_add.py](https://github.com/devilbox/vhost-gen) will add nginx vhost config files, the following will then 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.

```shell
watcherd -p /var/www -a vhost-add.sh -d vhost-del.sh -t "nginx -s stop"
watcherd -p /var/www -a "vhost_add.py -p %p -n %n" -d "rm %p" -t "nginx -s stop"
```

### Usage
Expand Down
2 changes: 1 addition & 1 deletion watcherd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ IFS=$'\n'

# Versioning
MY_NAME="watcherd"
MY_DATE="2017-09-16"
MY_DATE="2017-09-17"
MY_URL="https://github.com/devilbox/vhost-gen"
MY_AUTHOR="cytopia <[email protected]>"
MY_GPGKEY="0xA02C56F0"
Expand Down