fix(startup): reconcile profiles before bounded activation
Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
1 parent
b1e458a0a5
commit
e2cfccedf1
9 files changed
+338
-25
No files matched your search
@@ -77,13 +77,13 @@ cleanup() {
|
||||
trap cleanup EXIT
|
||||
trap 'exit 0' INT TERM
|
||||
|
||||
# Never invoke /opt/entrypoint.sh: zapret must start AFTER managed init.
|
||||
# Never invoke /opt/entrypoint.sh: zapret must start AFTER reconciliation.
|
||||
ss-server -c "$config_dir/server.json" &
|
||||
server_pid=$!
|
||||
ss-local -c "$config_dir/local.json" &
|
||||
local_pid=$!
|
||||
|
||||
# Bounded readiness, no network probe. Init/status verifies socket ownership.
|
||||
# Bounded readiness, no network probe. Managed commands verify socket ownership.
|
||||
attempt=0
|
||||
until awk '$2 == "00000000:0438" && $4 == "0A" { found=1 } END { exit !found }' /proc/net/tcp; do
|
||||
{ kill -0 "$server_pid" && kill -0 "$local_pid"; } || exit 75
|
||||
@@ -92,13 +92,13 @@ until awk '$2 == "00000000:0438" && $4 == "0A" { found=1 } END { exit !found }'
|
||||
sleep 1
|
||||
done
|
||||
if [ ! -e "$ZAPRET_CONFIG" ]; then
|
||||
/usr/local/bin/zapret-autotune managed init
|
||||
else
|
||||
# Never reinitialize/adopt persisted state; drift/pending state fails closed.
|
||||
/usr/local/bin/zapret-autotune managed status
|
||||
timeout -k 5 45 /usr/local/bin/zapret-autotune managed init || exit 78
|
||||
fi
|
||||
# Never activate pending or unknown bytes. Any reconciliation failure is fatal,
|
||||
# not a transient (75) restart request. Reload restores known bytes first.
|
||||
timeout -k 5 45 /usr/local/bin/zapret-autotune managed reconcile || exit 78
|
||||
zapret_started=1
|
||||
/opt/zapret2/init.d/sysv/zapret2 start
|
||||
timeout -k 5 30 /opt/zapret2/init.d/sysv/zapret2 start || exit 78
|
||||
|
||||
/usr/local/bin/zapret-autotune managed monitor &
|
||||
monitor_pid=$!
|
||||
|
||||
Reference in new issue
Block a user