Skip to content

Commit 3e69875

Browse files
authored
Merge pull request #3 from devilbox/WAT-003
WAT-003 Documentation for placeholder
2 parents 2e94180 + 86a9eea commit 3e69875

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@ Note, the trigger command will only be execute when at least one add or delete c
1010

1111
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.
1212

13+
### Placeholders
14+
15+
There are two placeholders available that make it easier to use custom commands/scripts for the add (`-a`) or delete (`-d`) action.:
16+
17+
* `%p` Full path to the directory that was added or deletd
18+
* `%n` Name of the directory that was added or deleted
19+
20+
You can specify the placeholders as many times as you want. See the following example section for usage.
21+
1322
### Examples
1423

15-
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.
24+
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.
1625

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

2130
### Usage

watcherd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ IFS=$'\n'
2525

2626
# Versioning
2727
MY_NAME="watcherd"
28-
MY_DATE="2017-09-16"
28+
MY_DATE="2017-09-17"
2929
MY_URL="https://github.com/devilbox/vhost-gen"
3030
MY_AUTHOR="cytopia <[email protected]>"
3131
MY_GPGKEY="0xA02C56F0"

0 commit comments

Comments
 (0)