mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-02 22:42:47 -04:00
a6de1bfc19
Exclude sample and md
23 lines
689 B
Plaintext
Executable File
23 lines
689 B
Plaintext
Executable File
#!/usr/bin/with-contenv bash
|
|
# shellcheck shell=bash
|
|
|
|
function wait_for_changes {
|
|
inotifywait -rq \
|
|
--event modify,move,create,delete \
|
|
--excludei '\.(sample|md)' \
|
|
"/config/nginx"
|
|
}
|
|
|
|
while wait_for_changes; do
|
|
NGINX_CONF=()
|
|
if ! grep -q "/config/nginx/nginx.conf" /etc/nginx/nginx.conf; then
|
|
NGINX_CONF=("-c" "/config/nginx/nginx.conf")
|
|
fi
|
|
if /usr/sbin/nginx "${NGINX_CONF[@]}" -t; then
|
|
echo "Changes to nginx config detected and the changes are valid, reloading nginx"
|
|
/usr/sbin/nginx "${NGINX_CONF[@]}" -s reload
|
|
else
|
|
echo "Changes to nginx config detected but the changes are not valid, skipping nginx reload. Please fix your config."
|
|
fi
|
|
done
|