Skip to content

Commit

Permalink
Allow for manually setting which inotify events to wait for
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3 committed Jun 9, 2024
1 parent bcd4ae7 commit 36265dd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ else
echo "HOOK_SCRIPT is not an executable file (missing +x bit), check file permissions of the hook script."
exit 1;
fi;
fi
fi;

while inotifywait -r /opt/monitor; do
ADDITIONAL_ARGS=""

if [ -z ${WATCH_EVENTS+x} ]; then
echo "Found watch events"
ADDITIONAL_ARGS="-e $WATCH_EVENTS"
fi;

echo "Final command: inotifywait $ADDITIONAL_ARGS -r /opt/monitor"

while inotifywait $ADDITIONAL_ARGS -r /opt/monitor; do
$HOOK_SCRIPT
done;

0 comments on commit 36265dd

Please sign in to comment.