fix: implement recovery mechanism for LocalAGI service during installation
This commit is contained in:
@@ -14,6 +14,21 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
|
LOCALAGI_SERVICE_NEEDS_RECOVERY=0
|
||||||
|
|
||||||
|
function cleanup_localagi_service() {
|
||||||
|
if [[ "${LOCALAGI_SERVICE_NEEDS_RECOVERY:-0}" == "1" ]] && ! systemctl is-active -q localagi; then
|
||||||
|
msg_warn "LocalAGI service is not active; attempting recovery start"
|
||||||
|
if systemctl start localagi; then
|
||||||
|
msg_ok "Recovered LocalAGI service"
|
||||||
|
else
|
||||||
|
msg_error "Failed to recover LocalAGI service"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup_localagi_service EXIT
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt install -y \
|
||||||
curl \
|
curl \
|
||||||
@@ -82,6 +97,7 @@ RestartSec=5
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
LOCALAGI_SERVICE_NEEDS_RECOVERY=1
|
||||||
systemctl enable -q --now localagi
|
systemctl enable -q --now localagi
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
@@ -89,6 +105,7 @@ if ! systemctl is-active -q localagi; then
|
|||||||
msg_error "Failed to start LocalAGI service"
|
msg_error "Failed to start LocalAGI service"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
LOCALAGI_SERVICE_NEEDS_RECOVERY=0
|
||||||
msg_ok "Started LocalAGI (${BACKEND})"
|
msg_ok "Started LocalAGI (${BACKEND})"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
|||||||
Reference in New Issue
Block a user