Skip to content

Commit

Permalink
Merge pull request #7 from devilbox/WAT-007
Browse files Browse the repository at this point in the history
WAT-007 Minor output fixes and better description
  • Loading branch information
cytopia authored Sep 30, 2017
2 parents af66bd7 + 279a248 commit 015ebbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/devilbox/watcherd.svg?branch=master)](https://travis-ci.org/devilbox/watcherd)

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.
**[watcherd](https://github.com/devilbox/watcherp/blob/master/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.

Expand All @@ -14,7 +14,7 @@ If you need the same functionality to monitor changes of listening ports, check

### Modes

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.
**[watcherd](https://github.com/devilbox/watcherp/blob/master/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

Expand All @@ -27,7 +27,7 @@ You can specify the placeholders as many times as you want. See the following ex

### Examples

By using [vhost_gen.py](https://github.com/devilbox/vhost-gen) (which will create nginx vhost config files), 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.
By using **[vhost_gen.py](https://github.com/devilbox/vhost-gen)** (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.

```shell
# %n will be replaced by watcherd with the new directory name
Expand Down
10 changes: 5 additions & 5 deletions 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-29"
MY_DATE="2017-09-30"
MY_URL="https://github.com/devilbox/watcherd"
MY_AUTHOR="cytopia <cytopia@everythingcli.org>"
MY_GPGKEY="0xA02C56F0"
Expand Down Expand Up @@ -298,11 +298,11 @@ if [ "${WATCHER}" = "inotify" ]; then
"${WATCH_DIR}" | while read -r output; do
d="${output##*\\}"
if [[ "${output}" =~ ^(CREATE|MOVED_TO),ISDIR/\\ ]]; then
if action "${d}" "${CMD_ADD}" "ADD" "${VERBOSE}"; then
if action "${d}" "${CMD_ADD}" "ADD:" "${VERBOSE}"; then
trigger "${CMD_TRIGGER}" "1" "${VERBOSE}"
fi
elif [[ "${output}" =~ ^(DELETE|MOVED_FROM),ISDIR/\\ ]]; then
if action "${d}" "${CMD_DEL}" "DEL" "${VERBOSE}"; then
if action "${d}" "${CMD_DEL}" "DEL:" "${VERBOSE}"; then
trigger "${CMD_TRIGGER}" "1" "${VERBOSE}"
fi
fi
Expand All @@ -329,14 +329,14 @@ else

# Run ADD command
for d in $ADD_DIRS; do
if action "${d}" "${CMD_ADD}" "ADD" "${VERBOSE}"; then
if action "${d}" "${CMD_ADD}" "ADD:" "${VERBOSE}"; then
CHANGES=1
fi
done

# Run DEL command
for d in $DEL_DIRS; do
if action "${d}" "${CMD_DEL}" "DEL" "${VERBOSE}"; then
if action "${d}" "${CMD_DEL}" "DEL:" "${VERBOSE}"; then
CHANGES=1
fi
done
Expand Down

0 comments on commit 015ebbe

Please sign in to comment.