forked from drGrove/docker-wkd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwkd-sync
More file actions
executable file
·42 lines (34 loc) · 769 Bytes
/
wkd-sync
File metadata and controls
executable file
·42 lines (34 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -eu
usage="$(basename "$0") -- Watch for file changes and run 'generate-wkd'
All flags passed to this command will fall through to 'generate-wkd'. For
details run:
'generate-wkd --help'
"
PARAMS=""
PASSTHROUGH="$@"
while [ "$#" -gt 0 ]; do
case "$1" in
-h|--help)
echo "$usage"
exit 0
;;
--use-folder|--folder)
WATCH_PATH=${2:=/data/}
shift 2
;;
--use-file|--file)
WATCH_PATH=${2:=/data/keys.txt}
shift 2
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
echo "Listening for events on ${WATCH_PATH}"
inotifywait -qme close_write,delete ${WATCH_PATH} |
while read -r filename event; do
generate-wkd ${PASSTHROUGH}
done