HTTP Healthcheck entfernt, wird nicht benötigt.
This commit is contained in:
parent
1473eed0e0
commit
2daaadc3b3
@ -35,11 +35,9 @@ ENABLE_IPV6=false
|
|||||||
# Wartezeit nach Neustart (Sekunden), dann Healthcheck
|
# Wartezeit nach Neustart (Sekunden), dann Healthcheck
|
||||||
WAIT_AFTER_RESTART=20
|
WAIT_AFTER_RESTART=20
|
||||||
|
|
||||||
# Healthcheck-Konfiguration: "http" oder "tcp"
|
# Healthcheck-Konfiguration: nur TCP
|
||||||
HEALTHCHECK_MODE="http"
|
|
||||||
HEALTHCHECK_URL="https://rtc.matrix.techniverse.net"
|
|
||||||
TCP_HOST="127.0.0.1"
|
TCP_HOST="127.0.0.1"
|
||||||
TCP_PORT="7880"
|
TCP_PORT="7881"
|
||||||
HEALTHCHECK_TIMEOUT=3
|
HEALTHCHECK_TIMEOUT=3
|
||||||
|
|
||||||
# ntfy (optional)
|
# ntfy (optional)
|
||||||
@ -201,10 +199,6 @@ restart_service() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
healthcheck_http() {
|
|
||||||
curl -fsS --max-time "$HEALTHCHECK_TIMEOUT" "$HEALTHCHECK_URL" >/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
healthcheck_tcp() {
|
healthcheck_tcp() {
|
||||||
if (exec 3<>/dev/tcp/"$TCP_HOST"/"$TCP_PORT") 2>/dev/null; then
|
if (exec 3<>/dev/tcp/"$TCP_HOST"/"$TCP_PORT") 2>/dev/null; then
|
||||||
exec 3<&-
|
exec 3<&-
|
||||||
@ -217,14 +211,6 @@ healthcheck_tcp() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
do_healthcheck() {
|
|
||||||
if [[ "$HEALTHCHECK_MODE" == "http" ]]; then
|
|
||||||
healthcheck_http
|
|
||||||
else
|
|
||||||
healthcheck_tcp
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
acquire_lock
|
acquire_lock
|
||||||
|
|
||||||
@ -236,7 +222,6 @@ main() {
|
|||||||
[[ -n "$CONTAINER_NAME" ]] || die "CONTAINER_NAME ist leer."
|
[[ -n "$CONTAINER_NAME" ]] || die "CONTAINER_NAME ist leer."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Aktuelle IP ermitteln
|
|
||||||
local current_ip cidr state_file
|
local current_ip cidr state_file
|
||||||
if [[ "$ENABLE_IPV6" == true ]]; then
|
if [[ "$ENABLE_IPV6" == true ]]; then
|
||||||
current_ip="$(get_ipv6)"
|
current_ip="$(get_ipv6)"
|
||||||
@ -264,7 +249,6 @@ main() {
|
|||||||
backup="$(backup_config)"
|
backup="$(backup_config)"
|
||||||
info "Backup erstellt: $backup"
|
info "Backup erstellt: $backup"
|
||||||
|
|
||||||
# YAML aktualisieren
|
|
||||||
if have_yq; then
|
if have_yq; then
|
||||||
info "Aktualisiere YAML mit yq → .rtc.ips.includes = [ \"$cidr\" ]"
|
info "Aktualisiere YAML mit yq → .rtc.ips.includes = [ \"$cidr\" ]"
|
||||||
update_yaml_with_yq "$cidr"
|
update_yaml_with_yq "$cidr"
|
||||||
@ -273,22 +257,19 @@ main() {
|
|||||||
update_yaml_fallback "$cidr"
|
update_yaml_fallback "$cidr"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Dienst neu starten
|
|
||||||
info "Restart des Dienstes..."
|
info "Restart des Dienstes..."
|
||||||
restart_service
|
restart_service
|
||||||
|
|
||||||
info "Warte $WAIT_AFTER_RESTART Sekunden..."
|
info "Warte $WAIT_AFTER_RESTART Sekunden..."
|
||||||
sleep "$WAIT_AFTER_RESTART"
|
sleep "$WAIT_AFTER_RESTART"
|
||||||
|
|
||||||
# Healthcheck
|
if healthcheck_tcp; then
|
||||||
if do_healthcheck; then
|
|
||||||
info "Healthcheck OK."
|
info "Healthcheck OK."
|
||||||
echo "$current_ip" > "$state_file"
|
echo "$current_ip" > "$state_file"
|
||||||
notify "info" "IP geändert auf $current_ip, Dienst gesund."
|
notify "info" "IP geändert auf $current_ip, Dienst gesund."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Rollback bei Fehler
|
|
||||||
warn "Healthcheck fehlgeschlagen – führe Rollback durch."
|
warn "Healthcheck fehlgeschlagen – führe Rollback durch."
|
||||||
cp -a "$backup" "$CONFIG_FILE"
|
cp -a "$backup" "$CONFIG_FILE"
|
||||||
info "Rollback-Konfiguration wiederhergestellt: $backup"
|
info "Rollback-Konfiguration wiederhergestellt: $backup"
|
||||||
@ -299,7 +280,7 @@ main() {
|
|||||||
info "Warte $WAIT_AFTER_RESTART Sekunden (Rollback)..."
|
info "Warte $WAIT_AFTER_RESTART Sekunden (Rollback)..."
|
||||||
sleep "$WAIT_AFTER_RESTART"
|
sleep "$WAIT_AFTER_RESTART"
|
||||||
|
|
||||||
if do_healthcheck; then
|
if healthcheck_tcp; then
|
||||||
warn "Rollback erfolgreich. System läuft wieder mit alter Konfiguration."
|
warn "Rollback erfolgreich. System läuft wieder mit alter Konfiguration."
|
||||||
notify "warn" "Rollback erfolgreich. Bitte prüfen. Alte IP bleibt ${last_ip:-unbekannt}."
|
notify "warn" "Rollback erfolgreich. Bitte prüfen. Alte IP bleibt ${last_ip:-unbekannt}."
|
||||||
exit 10
|
exit 10
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user