forked from hoppscotch/hoppscotch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealthcheck.sh
More file actions
25 lines (23 loc) · 789 Bytes
/
Copy pathhealthcheck.sh
File metadata and controls
25 lines (23 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
curlCheck() {
if ! curl -s --head "$1" | head -n 1 | grep -q "HTTP/1.[01] [23].."; then
echo "URL request failed!"
return 1
else
echo "URL request succeeded!"
return 0
fi
}
# Wait for initial startup period to avoid unnecessary error logs
# Check if the container has been running for at least 15 seconds
UPTIME=$(awk '{print int($1)}' /proc/uptime)
if [ "$UPTIME" -lt 15 ]; then
echo "Container still starting up (uptime: ${UPTIME}s), skipping health check..."
exit 0
fi
if [ "$ENABLE_SUBPATH_BASED_ACCESS" = "true" ]; then
curlCheck "http://localhost:${HOPP_AIO_ALTERNATE_PORT:-80}/backend/ping" || exit 1
else
curlCheck "http://localhost:3000" || exit 1
curlCheck "http://localhost:3100" || exit 1
curlCheck "http://localhost:3170/ping" || exit 1
fi