require stop to succeed and verify it starts back up

This commit is contained in:
dovholuknf
2026-07-23 16:27:05 -04:00
parent 69bac7aaeb
commit 1fb93fddae
3 changed files with 17 additions and 0 deletions
@@ -263,6 +263,11 @@ _rtr_svc_env_md5="$(md5sum /opt/openziti/etc/router/service.env | awk '{print $1
# and the admin's original bootstrap answers in bootstrap.env are preserved.
upgrade_local_debs "${TMPDIR}"
# postinstall must bring the services back itself; check before our own
# explicit restarts below so a failed restart isn't masked.
wait_for_service ziti-controller.service 30
wait_for_service ziti-router.service 20
# ============================================================
# Phase 5: Verify migration
# ============================================================
@@ -23,6 +23,12 @@ upgrade() {
# persistent account. Stop it first.
if detectDynamicUserState && systemctl is-active --quiet "${SVC_USER}.service" 2>/dev/null; then
systemctl stop "${SVC_USER}.service" || true
# createUser + migration below assume the transient DynamicUser is gone;
# if it's somehow still up, bail rather than migrate live state.
if systemctl is-active --quiet "${SVC_USER}.service" 2>/dev/null; then
echo "ERROR: could not stop ${SVC_USER}.service; aborting upgrade" >&2
exit 1
fi
_MIGRATION_STOPPED_SERVICE=true
fi
createUser
@@ -23,6 +23,12 @@ upgrade() {
# persistent account. Stop it first.
if detectDynamicUserState && systemctl is-active --quiet "${SVC_USER}.service" 2>/dev/null; then
systemctl stop "${SVC_USER}.service" || true
# createUser + migration below assume the transient DynamicUser is gone;
# if it's somehow still up, bail rather than migrate live state.
if systemctl is-active --quiet "${SVC_USER}.service" 2>/dev/null; then
echo "ERROR: could not stop ${SVC_USER}.service; aborting upgrade" >&2
exit 1
fi
_MIGRATION_STOPPED_SERVICE=true
fi
createUser