wait replace
This commit is contained in:
2025-08-02 00:50:14 +02:00
parent 87c2d13069
commit dcae51da9f
+26 -3
View File
@@ -90,6 +90,26 @@ zfs_replace() {
return 1 return 1
fi fi
} }
wait_replace() {
local timeout_seconds=86400 # Maximal 24 Stunden warten
local interval_seconds=300 # Alle 5 Minuten prüfen
local waited=0
log "Warte auf Abschluss von zpool replace..."
while (( waited < timeout_seconds )); do
if ! zfs_replace; then
log "Replace abgeschlossen nach $((waited/60)) Minuten System wird heruntergefahren."
return 0
fi
log "Replace läuft noch erneut prüfen in $((interval_seconds/60)) Minuten..."
sleep "$interval_seconds"
((waited+=interval_seconds))
done
log "WARNUNG: Replace nach $((timeout_seconds/3600)) Stunden noch nicht abgeschlossen kein Shutdown durchgeführt."
return 1
}
set_wol_g_enabled() { set_wol_g_enabled() {
log "Checking if ethtool is installed..." log "Checking if ethtool is installed..."
@@ -400,9 +420,12 @@ write_pbs_status() {
shutdown_now() { shutdown_now() {
if [[ "${SHUTDOWN,,}" == "yes" ]]; then if [[ "${SHUTDOWN,,}" == "yes" ]]; then
if zfs_replace; then if zfs_replace_in_progress; then
log "ZFS Replace-Vorgang erkannt Shutdown abgebrochen." log "ZFS Replace-Vorgang erkannt warte bis zum Abschluss..."
return if ! wait_for_replace_completion; then
log "Shutdown abgebrochen Replace ist nach max. Wartezeit noch nicht abgeschlossen."
return
fi
fi fi
send_piggyback send_piggyback