diff --git a/README.md b/README.md index 9ad2587..011ba64 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-auto-reload/run b/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-auto-reload/run index d4674de..06d3b88 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-auto-reload/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-auto-reload/run @@ -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 diff --git a/root/etc/services.d/inotify/run b/root/etc/services.d/inotify/run index d4674de..06d3b88 100755 --- a/root/etc/services.d/inotify/run +++ b/root/etc/services.d/inotify/run @@ -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