Skip to content

Commit

Permalink
create extraFilewatchExclude variable in .env.example, is used with t…
Browse files Browse the repository at this point in the history
…he new filewatch.sh script so that you can add additional excludes that only affect filewatch actions and not on-boot or manual backups. #106
  • Loading branch information
Tylerjet committed Jul 8, 2024
1 parent b928f8e commit 6b27533
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion utils/filewatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ done

watchlist=$(echo "$watchlist" | tr ' ' '\n' | sort -u | tr '\n' ' ')

exclude_pattern=".swp|.tmp|printer-[0-9]*_[0-9]*.cfg|.bak|.bkp"
# Convert exclude array to string delimitted by "|"
excludeString=$(printf "|%s" "${exclude[@]}")
excludeString="${excludeString:1}"
excludeString=$(echo "$excludeString" | sed 's/\*\./\./g')

if [ -z $extraFilewatchExclude ]; then
exclude_pattern="$excludeString"
else
exclude_pattern="$excludeString|$extraFilewatchExclude"
fi

inotifywait -mrP -e close_write -e move -e delete --exclude "$exclude_pattern" $watchlist |
while read -r path event file; do
Expand Down

0 comments on commit 6b27533

Please sign in to comment.