blob: a89d64e67b11ba7d0137d852838bb3c36fce2107 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/env sh
if [ -z ${HOOK_SCRIPT+x} ]; then
echo "Missing HOOK_SCRIPT environment variable, set it to the script to run upon file changes";
exit 1;
else
if ! test -f $HOOK_SCRIPT; then
echo "The file pointed to by HOOK_SCRIPT does not exist, check your container mounts.";
exit 1;
fi;
if ! test -x $HOOK_SCRIPT; then
echo "HOOK_SCRIPT is not an executable file (missing +x bit), check file permissions of the hook script."
exit 1;
fi;
fi;
ADDITIONAL_ARGS=$(if [[ -n "$WATCH_EVENTS" ]]; then echo "-e $WATCH_EVENTS"; else echo ""; fi)
while inotifywait $ADDITIONAL_ARGS -r /opt/monitor; do
$HOOK_SCRIPT
done;
|