mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-06-18 14:23:07 -04:00
Watch the whole folder
Exclude sample and md
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
# Auto-reload - Docker mod for Nginx based images
|
||||
|
||||
This mod allows Nginx to be reloaded automatically whenever there are valid changes to the `*.conf` files in `/config/nginx` or any files in the following folders:
|
||||
|
||||
- /config/nginx/proxy-confs
|
||||
- /config/nginx/site-confs
|
||||
This mod allows Nginx to be reloaded automatically whenever there are new files, or valid changes to the files in `/config/nginx`.
|
||||
|
||||
In the container's docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:swag-auto-reload`
|
||||
|
||||
|
||||
@@ -1,30 +1,11 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
DEFAULT_WATCH=()
|
||||
mapfile -t DEFAULT_WATCH < <(find /config/nginx -type f -name '*.conf' -print)
|
||||
DEFAULT_WATCH+=("/config/nginx/proxy-confs" "/config/nginx/site-confs")
|
||||
|
||||
# start with an empty array for active watch
|
||||
ACTIVE_WATCH=()
|
||||
echo "MOD Auto-reload: Watching the following files/folders for changes"
|
||||
for i in "${DEFAULT_WATCH[@]}"; do
|
||||
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
||||
echo "${i}"
|
||||
ACTIVE_WATCH+=("${i}")
|
||||
fi
|
||||
done
|
||||
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 \
|
||||
"${ACTIVE_WATCH[@]}"
|
||||
--excludei '\.(sample|md)' \
|
||||
"/config/nginx"
|
||||
}
|
||||
|
||||
while wait_for_changes; do
|
||||
|
||||
@@ -1,30 +1,11 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
DEFAULT_WATCH=()
|
||||
mapfile -t DEFAULT_WATCH < <(find /config/nginx -type f -name '*.conf' -print)
|
||||
DEFAULT_WATCH+=("/config/nginx/proxy-confs" "/config/nginx/site-confs")
|
||||
|
||||
# start with an empty array for active watch
|
||||
ACTIVE_WATCH=()
|
||||
echo "MOD Auto-reload: Watching the following files/folders for changes"
|
||||
for i in "${DEFAULT_WATCH[@]}"; do
|
||||
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
||||
echo "${i}"
|
||||
ACTIVE_WATCH+=("${i}")
|
||||
fi
|
||||
done
|
||||
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 \
|
||||
"${ACTIVE_WATCH[@]}"
|
||||
--excludei '\.(sample|md)' \
|
||||
"/config/nginx"
|
||||
}
|
||||
|
||||
while wait_for_changes; do
|
||||
|
||||
Reference in New Issue
Block a user