Fix logic

This commit is contained in:
Eric Nemchik 2022-09-22 14:52:32 +00:00
parent a6de1bfc19
commit d83f92e007
2 changed files with 22 additions and 2 deletions

View File

@ -1,11 +1,21 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
echo "MOD Auto-reload: Watching the following files/folders for changes (excluding .sample and .md files):"
echo "/config/nginx"
ACTIVE_WATCH=("/config/nginx")
for i in $(echo "${WATCHLIST}" | tr "|" " "); do
if [ -f "${i}" ] || [ -d "${i}" ]; then
echo "${i}"
ACTIVE_WATCH+=("${i}")
fi
done
function wait_for_changes {
inotifywait -rq \
--event modify,move,create,delete \
--excludei '\.(sample|md)' \
"/config/nginx"
"${ACTIVE_WATCH[@]}"
}
while wait_for_changes; do

View File

@ -1,11 +1,21 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
echo "MOD Auto-reload: Watching the following files/folders for changes (excluding .sample and .md files):"
echo "/config/nginx"
ACTIVE_WATCH=("/config/nginx")
for i in $(echo "${WATCHLIST}" | tr "|" " "); do
if [ -f "${i}" ] || [ -d "${i}" ]; then
echo "${i}"
ACTIVE_WATCH+=("${i}")
fi
done
function wait_for_changes {
inotifywait -rq \
--event modify,move,create,delete \
--excludei '\.(sample|md)' \
"/config/nginx"
"${ACTIVE_WATCH[@]}"
}
while wait_for_changes; do