Watch for changes recursively
This commit is contained in:
@@ -15,9 +15,6 @@ function is_change_event {
|
|||||||
EVENT="$1"
|
EVENT="$1"
|
||||||
FILE="$2"
|
FILE="$2"
|
||||||
|
|
||||||
# echo "EVENT=$EVENT"
|
|
||||||
# echo "FILE=$FILE"
|
|
||||||
|
|
||||||
# File events
|
# File events
|
||||||
if [ "$EVENT" == "ATTRIB" ]
|
if [ "$EVENT" == "ATTRIB" ]
|
||||||
then
|
then
|
||||||
@@ -187,7 +184,7 @@ pipe=$(mktemp -u)
|
|||||||
mkfifo $pipe
|
mkfifo $pipe
|
||||||
|
|
||||||
echo "$(ts) Waiting for changes to $WATCH_DIR..."
|
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
|
last_run_time=0
|
||||||
|
|
||||||
@@ -198,6 +195,9 @@ do
|
|||||||
EVENT=$(echo "$RECORD" | cut -d' ' -f 1)
|
EVENT=$(echo "$RECORD" | cut -d' ' -f 1)
|
||||||
FILE=$(echo "$RECORD" | cut -d' ' -f 2-)
|
FILE=$(echo "$RECORD" | cut -d' ' -f 2-)
|
||||||
|
|
||||||
|
echo "EVENT=$EVENT"
|
||||||
|
echo "FILE=$FILE"
|
||||||
|
|
||||||
if ! is_change_event "$EVENT" "$FILE"
|
if ! is_change_event "$EVENT" "$FILE"
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user