Skip to content
This repository was archived by the owner on Jan 7, 2024. It is now read-only.

Commit 09ab126

Browse files
committed
Use status endpoint for readiness check
1 parent be8039d commit 09ab126

File tree

2 files changed

+11
-2
lines changed
  • root/etc/s6-overlay/s6-rc.d/svc-unifi-controller

2 files changed

+11
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
if [[ $(curl -skL "https://localhost:${WEB_PORT:-8443}/status" | jq -r '.meta.up' 2>/dev/null) = true ]]; then
4+
exit 0
5+
else
6+
exit 1
7+
fi
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4+
WEB_PORT=$(grep 'unifi.https.port=' '/config/data/system.properties' | awk -F '=' '{print $2}')
5+
46
if [[ -z ${MEM_LIMIT} ]] || [[ ${MEM_LIMIT} = "default" ]]; then
57
MEM_LIMIT="1024"
68
fi
79

810
if [[ -z ${MEM_STARTUP} ]] || [[ ${MEM_STARTUP} = "default" ]]; then
911
exec \
10-
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8443" \
12+
s6-notifyoncheck -d -n 600 -w 1000 \
1113
cd /config s6-setuidgid abc java -Xmx"${MEM_LIMIT}M" -Dlog4j2.formatMsgNoLookups=true -jar /usr/lib/unifi/lib/ace.jar start;
1214
else
1315
exec \
14-
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8443" \
16+
s6-notifyoncheck -d -n 600 -w 1000 \
1517
cd /config s6-setuidgid abc java -Xms"${MEM_STARTUP}M" -Xmx"${MEM_LIMIT}M" -Dlog4j2.formatMsgNoLookups=true -jar /usr/lib/unifi/lib/ace.jar start;
1618
fi

0 commit comments

Comments
 (0)