switch to hybrid

This commit is contained in:
aptalca
2022-08-18 14:19:06 -04:00
parent 8b392226e3
commit ad0b8298fb
11 changed files with 53 additions and 0 deletions
@@ -0,0 +1,8 @@
#!/usr/bin/with-contenv bash
if ! apk info 2>&1 | grep -q "inotify-tools"; then
echo "**** Adding swag-auto-reload deps to package install list ****"
echo "inotify-tools" >> /mod-repo-packages-to-install.list
else
echo "**** swag-auto-reload deps already installed, skipping ****"
fi
@@ -0,0 +1 @@
oneshot
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mod-swag-auto-reload-add-package/run
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/with-contenv bash
DEFAULT_WATCH=( \
/config/nginx/authelia-location.conf \
/config/nginx/authelia-server.conf \
/config/nginx/geoip2.conf \
/config/nginx/ldap.conf \
/config/nginx/nginx.conf \
/config/nginx/proxy-confs \
/config/nginx/proxy.conf \
/config/nginx/site-confs \
/config/nginx/ssl.conf \
)
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="${ACTIVE_WATCH} ${i}"
fi
done
for i in $(echo "$WATCHLIST" | tr "|" " "); do
if [ -f "${i}" ] || [ -d "${i}" ]; then
echo "${i}"
ACTIVE_WATCH="${ACTIVE_WATCH} ${i}"
fi
done
function wait_for_changes {
inotifywait -rq \
--event modify,move,create,delete \
${ACTIVE_WATCH}
}
while wait_for_changes; do
if /usr/sbin/nginx -c /config/nginx/nginx.conf -t; then
echo "Changes to nginx config detected and the changes are valid, reloading nginx"
/usr/sbin/nginx -c /config/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
@@ -0,0 +1 @@
longrun
Regular → Executable
View File