From 5bdabd6ad7650ee0105dbc48ee9016317394fca2 Mon Sep 17 00:00:00 2001 From: David Coppit Date: Wed, 24 Jun 2015 08:22:43 -0400 Subject: [PATCH] Watch for changes recursively --- monitor.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monitor.sh b/monitor.sh index ceef4d3..53172a9 100755 --- a/monitor.sh +++ b/monitor.sh @@ -15,9 +15,6 @@ function is_change_event { EVENT="$1" FILE="$2" -# echo "EVENT=$EVENT" -# echo "FILE=$FILE" - # File events if [ "$EVENT" == "ATTRIB" ] then @@ -187,7 +184,7 @@ pipe=$(mktemp -u) mkfifo $pipe echo "$(ts) Waiting for changes to $WATCH_DIR..." -inotifywait -m -q --format '%e %f' $WATCH_DIR >$pipe & +inotifywait -r -m -q --format '%e %f' $WATCH_DIR >$pipe & last_run_time=0 @@ -198,6 +195,9 @@ do EVENT=$(echo "$RECORD" | cut -d' ' -f 1) FILE=$(echo "$RECORD" | cut -d' ' -f 2-) + echo "EVENT=$EVENT" + echo "FILE=$FILE" + if ! is_change_event "$EVENT" "$FILE" then continue