Backup automatico script del 2026-11-01 07:00
This commit is contained in:
1 parent
8ad51325ce
commit
48c0d0c21e
11 files changed
+883
-4
No files matched your search
@@ -558,6 +558,19 @@ if ((${#WARNINGS[@]} > 0)); then
|
||||
fi
|
||||
append_report "Fine: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
# 5b. Il peer deve poter coprire: niente reboot se è giù o in manutenzione
|
||||
# (31/10: Pi-1 riavviato alle 04:50 con Pi-2 già giù → rete senza nessun nodo).
|
||||
REBOOT_GUARD="/home/daniely/rete/scripts/maintenance-reboot-guard.sh"
|
||||
if [[ "$REBOOT_ON_SUCCESS" == true && -x "$REBOOT_GUARD" ]]; then
|
||||
if guard_msg="$("$REBOOT_GUARD" check 2>&1)"; then
|
||||
log "Guardia reboot: ${guard_msg}"
|
||||
else
|
||||
REBOOT_ON_SUCCESS=false
|
||||
WARNINGS+=("Reboot saltato: ${guard_msg}")
|
||||
log "⚠ Reboot saltato: ${guard_msg}"
|
||||
fi
|
||||
fi
|
||||
|
||||
build_telegram_summary
|
||||
|
||||
# 6. Reboot fisso di conclusione (salvo --no-reboot o REBOOT_ON_SUCCESS=false in conf)
|
||||
@@ -566,6 +579,9 @@ if [[ "$REBOOT_ON_SUCCESS" == true ]]; then
|
||||
append_report ""
|
||||
append_report "=== Reboot ==="
|
||||
append_report "Programmato tra ${REBOOT_DELAY_MIN} minuti"
|
||||
# Annuncio al peer: prende il VIP ma non pivota le app, e se il nodo non
|
||||
# torna entro il TTL il suo watchdog fa il failover vero.
|
||||
[[ -x "$REBOOT_GUARD" ]] && "$REBOOT_GUARD" announce "$REBOOT_DELAY_MIN" || true
|
||||
/usr/sbin/shutdown -r "+${REBOOT_DELAY_MIN}" "Manutenzione settimanale ${HOST_LABEL}" || {
|
||||
ERRORS+=("shutdown -r (reboot programmato)")
|
||||
log "✗ Impossibile programmare il reboot"
|
||||
|
||||
@@ -558,6 +558,19 @@ if ((${#WARNINGS[@]} > 0)); then
|
||||
fi
|
||||
append_report "Fine: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
# 5b. Il peer deve poter coprire: niente reboot se è giù o in manutenzione
|
||||
# (31/10: Pi-1 riavviato alle 04:50 con Pi-2 già giù → rete senza nessun nodo).
|
||||
REBOOT_GUARD="/home/daniely/rete/scripts/maintenance-reboot-guard.sh"
|
||||
if [[ "$REBOOT_ON_SUCCESS" == true && -x "$REBOOT_GUARD" ]]; then
|
||||
if guard_msg="$("$REBOOT_GUARD" check 2>&1)"; then
|
||||
log "Guardia reboot: ${guard_msg}"
|
||||
else
|
||||
REBOOT_ON_SUCCESS=false
|
||||
WARNINGS+=("Reboot saltato: ${guard_msg}")
|
||||
log "⚠ Reboot saltato: ${guard_msg}"
|
||||
fi
|
||||
fi
|
||||
|
||||
build_telegram_summary
|
||||
|
||||
# 6. Reboot fisso di conclusione (salvo --no-reboot o REBOOT_ON_SUCCESS=false in conf)
|
||||
@@ -566,6 +579,9 @@ if [[ "$REBOOT_ON_SUCCESS" == true ]]; then
|
||||
append_report ""
|
||||
append_report "=== Reboot ==="
|
||||
append_report "Programmato tra ${REBOOT_DELAY_MIN} minuti"
|
||||
# Annuncio al peer: prende il VIP ma non pivota le app, e se il nodo non
|
||||
# torna entro il TTL il suo watchdog fa il failover vero.
|
||||
[[ -x "$REBOOT_GUARD" ]] && "$REBOOT_GUARD" announce "$REBOOT_DELAY_MIN" || true
|
||||
/usr/sbin/shutdown -r "+${REBOOT_DELAY_MIN}" "Manutenzione settimanale ${HOST_LABEL}" || {
|
||||
ERRORS+=("shutdown -r (reboot programmato)")
|
||||
log "✗ Impossibile programmare il reboot"
|
||||
|
||||