v2.03
wait replace
This commit is contained in:
+26
-3
@@ -90,6 +90,26 @@ zfs_replace() {
|
||||
return 1
|
||||
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() {
|
||||
log "Checking if ethtool is installed..."
|
||||
|
||||
@@ -400,9 +420,12 @@ write_pbs_status() {
|
||||
|
||||
shutdown_now() {
|
||||
if [[ "${SHUTDOWN,,}" == "yes" ]]; then
|
||||
if zfs_replace; then
|
||||
log "ZFS Replace-Vorgang erkannt – Shutdown abgebrochen."
|
||||
return
|
||||
if zfs_replace_in_progress; then
|
||||
log "ZFS Replace-Vorgang erkannt – warte bis zum Abschluss..."
|
||||
if ! wait_for_replace_completion; then
|
||||
log "Shutdown abgebrochen – Replace ist nach max. Wartezeit noch nicht abgeschlossen."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
send_piggyback
|
||||
|
||||
Reference in New Issue
Block a user