Skip to content

Commit 346be61

Browse files
committed
reload upadte
1 parent 5fc14a8 commit 346be61

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

nginx-f1/nginx-reloader.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,14 @@ log "Starting nginx-reloader, watching: ${WATCH_DIR} for *.conf files (delay: ${
1515

1616
while true
1717
do
18-
FILE=$(inotifywait --recursive --format '%f' -e create -e modify -e delete -e move "${WATCH_DIR}" 2>/dev/null)
19-
20-
if [[ "${FILE}" == *.conf ]]; then
21-
sleep "${RELOADER_DELAY}"
22-
log "Detected: ${FILE}"
23-
nginx -t
24-
if [[ $? -eq 0 ]]; then
25-
log "Config valid, reloading nginx"
26-
nginx -s reload
27-
else
28-
log "Config test failed, skipping reload"
29-
fi
18+
sleep "${RELOADER_DELAY}"
19+
FILE=$(inotifywait --recursive --include '\.conf$' --format '%f' -e create -e modify -e delete -e move "${WATCH_DIR}" 2>/dev/null)
20+
log "Detected: ${FILE}"
21+
nginx -t
22+
if [[ $? -eq 0 ]]; then
23+
log "Config valid, reloading nginx"
24+
nginx -s reload
25+
else
26+
log "Config test failed, skipping reload"
3027
fi
3128
done

0 commit comments

Comments
 (0)