Skip to content

Commit d83f92e

Browse files
committed
Fix logic
1 parent a6de1bf commit d83f92e

File tree

2 files changed

+22
-2
lines changed
  • root/etc
    • s6-overlay/s6-rc.d/svc-mod-swag-auto-reload
    • services.d/inotify

2 files changed

+22
-2
lines changed

root/etc/s6-overlay/s6-rc.d/svc-mod-swag-auto-reload/run

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4+
echo "MOD Auto-reload: Watching the following files/folders for changes (excluding .sample and .md files):"
5+
echo "/config/nginx"
6+
ACTIVE_WATCH=("/config/nginx")
7+
for i in $(echo "${WATCHLIST}" | tr "|" " "); do
8+
if [ -f "${i}" ] || [ -d "${i}" ]; then
9+
echo "${i}"
10+
ACTIVE_WATCH+=("${i}")
11+
fi
12+
done
13+
414
function wait_for_changes {
515
inotifywait -rq \
616
--event modify,move,create,delete \
717
--excludei '\.(sample|md)' \
8-
"/config/nginx"
18+
"${ACTIVE_WATCH[@]}"
919
}
1020

1121
while wait_for_changes; do

root/etc/services.d/inotify/run

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4+
echo "MOD Auto-reload: Watching the following files/folders for changes (excluding .sample and .md files):"
5+
echo "/config/nginx"
6+
ACTIVE_WATCH=("/config/nginx")
7+
for i in $(echo "${WATCHLIST}" | tr "|" " "); do
8+
if [ -f "${i}" ] || [ -d "${i}" ]; then
9+
echo "${i}"
10+
ACTIVE_WATCH+=("${i}")
11+
fi
12+
done
13+
414
function wait_for_changes {
515
inotifywait -rq \
616
--event modify,move,create,delete \
717
--excludei '\.(sample|md)' \
8-
"/config/nginx"
18+
"${ACTIVE_WATCH[@]}"
919
}
1020

1121
while wait_for_changes; do

0 commit comments

Comments
 (0)