Skip to content

Commit

Permalink
Add time stamps to console messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rednoah committed Apr 11, 2024
1 parent 0418fb5 commit adbe775
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions watcher/opt/bin/filebot-watcher
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/sh

inotifywait --monitor "$1" --event create --event moved_to --event modify --exclude '/[.@]' --format '%w%f' $INOTIFYWAIT_OPTS | stdbuf -oL uniq | while read -r FILE; do
TODAY="$(date '+%Y/%m/%d %H:%M:%S %Z')"

echo "[INOTIFY] $FILE"

# make sure to inform the user that we are waiting for things to settle down
echo "Waiting $SETTLE_DOWN_TIME seconds for changes to settle down..."
echo "[$TODAY] Waiting $SETTLE_DOWN_TIME seconds for changes to settle down..."

# file may yield inode/x-empty for new files
sleep "$SETTLE_DOWN_TIME"
Expand All @@ -13,7 +15,7 @@ inotifywait --monitor "$1" --event create --event moved_to --event modify --excl
RECENTLY_MODIFIED_FILES="$(find "$1" -type f -newermt "$SETTLE_DOWN_CHECK" -not -path '*/[.@]*' -print -quit)"

if [ -n "$RECENTLY_MODIFIED_FILES" ]; then
echo "$RECENTLY_MODIFIED_FILES was modified less than $SETTLE_DOWN_CHECK"
echo "[$TODAY] $RECENTLY_MODIFIED_FILES was modified less than $SETTLE_DOWN_CHECK"
echo "Processing deferred until next change..."
continue
fi
Expand Down

0 comments on commit adbe775

Please sign in to comment.