check start

This commit is contained in:
shocknet-justin 2025-08-31 17:05:40 -04:00
parent 08fba7a730
commit 3a14333a70

View file

@ -65,9 +65,27 @@ start_services() {
# Check Lightning.Pub status after attempting to start # Check Lightning.Pub status after attempting to start
if [ "$PUB_UPGRADE" = "0" ] || [ "$PUB_UPGRADE" = "100" ]; then if [ "$PUB_UPGRADE" = "0" ] || [ "$PUB_UPGRADE" = "100" ]; then
if ! $SYSTEMCTL_CMD is-active --quiet lightning_pub; then SERVICE_ACTIVE=false
log "Failed to start or restart ${SECONDARY_COLOR}Lightning.Pub${RESET_COLOR}. Please check the logs." for i in {1..15}; do
exit 1 if $SYSTEMCTL_CMD is-active --quiet lightning_pub; then
SERVICE_ACTIVE=true
break
fi
# Check for failed state to exit early
if $SYSTEMCTL_CMD is-failed --quiet lightning_pub; then
break
fi
sleep 1
done
if [ "$SERVICE_ACTIVE" = false ]; then
log "${PRIMARY_COLOR}ERROR:${RESET_COLOR} ${SECONDARY_COLOR}Lightning.Pub${RESET_COLOR} service failed to start. Recent logs:"
if [ "$IS_ROOT" = true ]; then
journalctl -u lightning_pub.service -n 20 --no-pager | while IFS= read -r line; do log " $line"; done
else
journalctl --user-unit lightning_pub.service -n 20 --no-pager | while IFS= read -r line; do log " $line"; done
fi
log_error "Service startup failed." 1
fi fi
fi fi