Skip to content

Commit 7469d5f

Browse files
committed
fix: validate supervisorctl exit code
The supervisorctl status is actually exit with 3, so handle this gracefully. Fixes #3997 Replaces #3996
1 parent 35f3f69 commit 7469d5f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

health_check

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/sh
22

3-
set -e
4-
53
# Web health check if web is started in this container
64
if [ -f /run/supervisor.conf.d/web.conf ]; then
75
if [ -f /app/data/ssl/privkey.pem ]; then
@@ -13,6 +11,14 @@ fi
1311

1412
# Supervisor based health check
1513
services="$(/app/venv/bin/supervisorctl status)"
14+
status_code=$?
15+
# 3 is expected as there is a single stopped service (check)
16+
if [ $status_code -ne 0 ] && [ $status_code -ne 3 ]; then
17+
echo "supervisorctl failed ($status_code)"
18+
exit 1
19+
fi
20+
21+
# Look for failed services
1622
failing="$(echo "$services" | grep -v '^check *EXITED\|RUNNING' || true)"
1723
if [ -n "$failing" ]; then
1824
echo "$failing"

0 commit comments

Comments
 (0)