updater.sh aktualisiert
This commit is contained in:
1 parent
a3a4e87c75
commit
98c6d95c45
1 file changed
+50
-137
+50
-137
@@ -36,10 +36,6 @@ VM_OK=0
|
|||||||
VM_FAILED=0
|
VM_FAILED=0
|
||||||
VM_SKIPPED=0
|
VM_SKIPPED=0
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Grundprüfung / Logging
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "FEHLER: Als root ausführen."
|
echo "FEHLER: Als root ausführen."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -52,17 +48,12 @@ fi
|
|||||||
|
|
||||||
touch "$LOG_FILE"
|
touch "$LOG_FILE"
|
||||||
chmod 600 "$LOG_FILE"
|
chmod 600 "$LOG_FILE"
|
||||||
|
|
||||||
exec > >(tee -a "$LOG_FILE") 2>&1
|
exec > >(tee -a "$LOG_FILE") 2>&1
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Hilfe
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
Proxmox Guest Updater
|
Proxmox Guest Updater
|
||||||
@@ -95,35 +86,24 @@ while [[ $# -gt 0 ]]; do
|
|||||||
MODE="check"
|
MODE="check"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--ct)
|
--ct)
|
||||||
[[ $# -ge 2 ]] || {
|
[[ $# -ge 2 ]] || { echo "--ct benötigt eine ID."; exit 2; }
|
||||||
echo "--ct benötigt eine ID."
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
ONLY_CT="$2"
|
ONLY_CT="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--vm)
|
--vm)
|
||||||
[[ $# -ge 2 ]] || {
|
[[ $# -ge 2 ]] || { echo "--vm benötigt eine ID."; exit 2; }
|
||||||
echo "--vm benötigt eine ID."
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
ONLY_VM="$2"
|
ONLY_VM="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--no-reboot)
|
--no-reboot)
|
||||||
NO_REBOOT="yes"
|
NO_REBOOT="yes"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--help|-h)
|
--help|-h)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Unbekannte Option: $1"
|
echo "Unbekannte Option: $1"
|
||||||
usage
|
usage
|
||||||
@@ -132,18 +112,12 @@ while [[ $# -gt 0 ]]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Allgemeine Funktionen
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
is_excluded() {
|
is_excluded() {
|
||||||
local id="$1"
|
local id="$1"
|
||||||
local x
|
local x
|
||||||
|
|
||||||
for x in $EXCLUDE_GUESTS; do
|
for x in $EXCLUDE_GUESTS; do
|
||||||
[[ "$x" == "$id" ]] && return 0
|
[[ "$x" == "$id" ]] && return 0
|
||||||
done
|
done
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,20 +134,13 @@ wait_for_apt() {
|
|||||||
if (( waited >= APT_LOCK_TIMEOUT )); then
|
if (( waited >= APT_LOCK_TIMEOUT )); then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
waited=$((waited + 5))
|
waited=$((waited + 5))
|
||||||
done
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Proxmox Host
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
host_reboot_required() {
|
host_reboot_required() {
|
||||||
|
|
||||||
if [[ -e /var/run/reboot-required ]]; then
|
if [[ -e /var/run/reboot-required ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -187,8 +154,7 @@ host_reboot_required() {
|
|||||||
dpkg-query -W -f='${Package}\n' \
|
dpkg-query -W -f='${Package}\n' \
|
||||||
'proxmox-kernel-*-signed' \
|
'proxmox-kernel-*-signed' \
|
||||||
'pve-kernel-*' 2>/dev/null |
|
'pve-kernel-*' 2>/dev/null |
|
||||||
sed -nE \
|
sed -nE 's/^(proxmox-kernel-|pve-kernel-)(.+)(-signed)?$/\2/p' |
|
||||||
's/^(proxmox-kernel-|pve-kernel-)(.+)(-signed)?$/\2/p' |
|
|
||||||
sort -V |
|
sort -V |
|
||||||
tail -n1
|
tail -n1
|
||||||
)"
|
)"
|
||||||
@@ -201,7 +167,6 @@ host_reboot_required() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_host() {
|
check_host() {
|
||||||
|
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
log "Proxmox-Host prüfen"
|
log "Proxmox-Host prüfen"
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
@@ -221,7 +186,6 @@ check_host() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local count
|
local count
|
||||||
|
|
||||||
count="$(
|
count="$(
|
||||||
apt list --upgradable 2>/dev/null |
|
apt list --upgradable 2>/dev/null |
|
||||||
tail -n +2 |
|
tail -n +2 |
|
||||||
@@ -230,12 +194,10 @@ check_host() {
|
|||||||
)"
|
)"
|
||||||
|
|
||||||
log "Proxmox-Host: $count Update(s) verfügbar."
|
log "Proxmox-Host: $count Update(s) verfügbar."
|
||||||
|
|
||||||
HOST_OK="yes"
|
HOST_OK="yes"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_host() {
|
update_host() {
|
||||||
|
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
log "Proxmox-Host aktualisieren"
|
log "Proxmox-Host aktualisieren"
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
@@ -254,7 +216,11 @@ update_host() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if DEBIAN_FRONTEND=noninteractive apt-get -y full-upgrade; then
|
if DEBIAN_FRONTEND=noninteractive apt-get -y \
|
||||||
|
-o Dpkg::Options::="--force-confdef" \
|
||||||
|
-o Dpkg::Options::="--force-confold" \
|
||||||
|
full-upgrade
|
||||||
|
then
|
||||||
HOST_OK="yes"
|
HOST_OK="yes"
|
||||||
log "Proxmox-Host erfolgreich aktualisiert."
|
log "Proxmox-Host erfolgreich aktualisiert."
|
||||||
else
|
else
|
||||||
@@ -273,34 +239,23 @@ update_host() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# LXC
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
lxc_name() {
|
lxc_name() {
|
||||||
pct config "$1" 2>/dev/null |
|
pct config "$1" 2>/dev/null |
|
||||||
awk -F': ' '$1=="hostname"{print $2; exit}'
|
awk -F': ' '$1=="hostname"{print $2; exit}'
|
||||||
}
|
}
|
||||||
|
|
||||||
lxc_supported() {
|
lxc_supported() {
|
||||||
|
|
||||||
pct exec "$1" -- sh -c '
|
pct exec "$1" -- sh -c '
|
||||||
[ -r /etc/os-release ] || exit 1
|
[ -r /etc/os-release ] || exit 1
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
|
|
||||||
case "${ID:-}" in
|
case "${ID:-}" in
|
||||||
debian|ubuntu)
|
debian|ubuntu) exit 0 ;;
|
||||||
exit 0
|
*) exit 1 ;;
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
' >/dev/null 2>&1
|
' >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
check_lxc() {
|
check_lxc() {
|
||||||
|
|
||||||
local id="$1"
|
local id="$1"
|
||||||
local name
|
local name
|
||||||
local status
|
local status
|
||||||
@@ -308,11 +263,7 @@ check_lxc() {
|
|||||||
|
|
||||||
name="$(lxc_name "$id")"
|
name="$(lxc_name "$id")"
|
||||||
name="${name:-unbekannt}"
|
name="${name:-unbekannt}"
|
||||||
|
status="$(pct status "$id" 2>/dev/null | awk '{print $2}')"
|
||||||
status="$(
|
|
||||||
pct status "$id" 2>/dev/null |
|
|
||||||
awk '{print $2}'
|
|
||||||
)"
|
|
||||||
|
|
||||||
if is_excluded "$id"; then
|
if is_excluded "$id"; then
|
||||||
log "CT $id ($name): ausgeschlossen."
|
log "CT $id ($name): ausgeschlossen."
|
||||||
@@ -347,6 +298,7 @@ check_lxc() {
|
|||||||
tail -n +2 |
|
tail -n +2 |
|
||||||
sed '/^[[:space:]]*$/d' |
|
sed '/^[[:space:]]*$/d' |
|
||||||
wc -l" 2>/dev/null |
|
wc -l" 2>/dev/null |
|
||||||
|
tail -n1 |
|
||||||
tr -d '\r[:space:]'
|
tr -d '\r[:space:]'
|
||||||
)"
|
)"
|
||||||
|
|
||||||
@@ -354,19 +306,15 @@ check_lxc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_lxc() {
|
update_lxc() {
|
||||||
|
|
||||||
local id="$1"
|
local id="$1"
|
||||||
local name
|
local name
|
||||||
local status
|
local status
|
||||||
local started_by_us="no"
|
local started_by_us="no"
|
||||||
|
local reboot_required="no"
|
||||||
|
|
||||||
name="$(lxc_name "$id")"
|
name="$(lxc_name "$id")"
|
||||||
name="${name:-unbekannt}"
|
name="${name:-unbekannt}"
|
||||||
|
status="$(pct status "$id" 2>/dev/null | awk '{print $2}')"
|
||||||
status="$(
|
|
||||||
pct status "$id" 2>/dev/null |
|
|
||||||
awk '{print $2}'
|
|
||||||
)"
|
|
||||||
|
|
||||||
if is_excluded "$id"; then
|
if is_excluded "$id"; then
|
||||||
log "CT $id ($name): ausgeschlossen."
|
log "CT $id ($name): ausgeschlossen."
|
||||||
@@ -375,7 +323,6 @@ update_lxc() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$status" != "running" ]]; then
|
if [[ "$status" != "running" ]]; then
|
||||||
|
|
||||||
if [[ "$UPDATE_STOPPED" != "yes" ]]; then
|
if [[ "$UPDATE_STOPPED" != "yes" ]]; then
|
||||||
log "CT $id ($name): gestoppt -> übersprungen."
|
log "CT $id ($name): gestoppt -> übersprungen."
|
||||||
LXC_SKIPPED=$((LXC_SKIPPED + 1))
|
LXC_SKIPPED=$((LXC_SKIPPED + 1))
|
||||||
@@ -423,7 +370,7 @@ update_lxc() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! pct exec "$id" -- bash -lc \
|
if ! pct exec "$id" -- bash -lc \
|
||||||
'DEBIAN_FRONTEND=noninteractive apt-get -y full-upgrade'
|
'DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" full-upgrade'
|
||||||
then
|
then
|
||||||
log "CT $id ($name): full-upgrade FEHLER."
|
log "CT $id ($name): full-upgrade FEHLER."
|
||||||
LXC_FAILED=$((LXC_FAILED + 1))
|
LXC_FAILED=$((LXC_FAILED + 1))
|
||||||
@@ -436,9 +383,8 @@ update_lxc() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if pct exec "$id" -- test -e /var/run/reboot-required \
|
if pct exec "$id" -- test -e /var/run/reboot-required >/dev/null 2>&1; then
|
||||||
>/dev/null 2>&1
|
reboot_required="yes"
|
||||||
then
|
|
||||||
log "CT $id ($name): Update erfolgreich - Neustart erforderlich."
|
log "CT $id ($name): Update erfolgreich - Neustart erforderlich."
|
||||||
else
|
else
|
||||||
log "CT $id ($name): Update erfolgreich."
|
log "CT $id ($name): Update erfolgreich."
|
||||||
@@ -448,14 +394,32 @@ update_lxc() {
|
|||||||
|
|
||||||
if [[ "$started_by_us" == "yes" ]]; then
|
if [[ "$started_by_us" == "yes" ]]; then
|
||||||
log "CT $id ($name): war vorher gestoppt -> wird wieder heruntergefahren."
|
log "CT $id ($name): war vorher gestoppt -> wird wieder heruntergefahren."
|
||||||
pct shutdown "$id" --timeout 60 || pct stop "$id"
|
if ! pct shutdown "$id" --timeout 60; then
|
||||||
|
log "CT $id ($name): sauberer Shutdown fehlgeschlagen -> Stop."
|
||||||
|
if ! pct stop "$id"; then
|
||||||
|
log "FEHLER: CT $id ($name) konnte nicht gestoppt werden."
|
||||||
|
LXC_OK=$((LXC_OK - 1))
|
||||||
|
LXC_FAILED=$((LXC_FAILED + 1))
|
||||||
|
ERRORS=$((ERRORS + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$reboot_required" == "yes" ]]; then
|
||||||
|
log "CT $id ($name): automatischer Neustart ..."
|
||||||
|
|
||||||
|
if pct reboot "$id" --timeout 60; then
|
||||||
|
log "CT $id ($name): Neustart erfolgreich ausgelöst."
|
||||||
|
else
|
||||||
|
log "FEHLER: CT $id ($name) konnte nicht neu gestartet werden."
|
||||||
|
LXC_OK=$((LXC_OK - 1))
|
||||||
|
LXC_FAILED=$((LXC_FAILED + 1))
|
||||||
|
ERRORS=$((ERRORS + 1))
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# QEMU VM
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
vm_name() {
|
vm_name() {
|
||||||
qm config "$1" 2>/dev/null |
|
qm config "$1" 2>/dev/null |
|
||||||
awk -F': ' '$1=="name"{print $2; exit}'
|
awk -F': ' '$1=="name"{print $2; exit}'
|
||||||
@@ -471,7 +435,6 @@ vm_agent_alive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vm_is_linux() {
|
vm_is_linux() {
|
||||||
|
|
||||||
local id="$1"
|
local id="$1"
|
||||||
local os
|
local os
|
||||||
|
|
||||||
@@ -483,28 +446,19 @@ vm_is_linux() {
|
|||||||
)"
|
)"
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu)
|
debian|ubuntu) return 0 ;;
|
||||||
return 0
|
*) return 1 ;;
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
check_vm() {
|
check_vm() {
|
||||||
|
|
||||||
local id="$1"
|
local id="$1"
|
||||||
local name
|
local name
|
||||||
local status
|
local status
|
||||||
|
|
||||||
name="$(vm_name "$id")"
|
name="$(vm_name "$id")"
|
||||||
name="${name:-unbekannt}"
|
name="${name:-unbekannt}"
|
||||||
|
status="$(qm status "$id" 2>/dev/null | awk '{print $2}')"
|
||||||
status="$(
|
|
||||||
qm status "$id" 2>/dev/null |
|
|
||||||
awk '{print $2}'
|
|
||||||
)"
|
|
||||||
|
|
||||||
if is_excluded "$id"; then
|
if is_excluded "$id"; then
|
||||||
log "VM $id ($name): ausgeschlossen."
|
log "VM $id ($name): ausgeschlossen."
|
||||||
@@ -537,7 +491,6 @@ check_vm() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "VM $id ($name): Debian/Ubuntu erkannt."
|
log "VM $id ($name): Debian/Ubuntu erkannt."
|
||||||
|
|
||||||
log "VM $id ($name): automatische Paketinstallation über QEMU Guest Agent"
|
log "VM $id ($name): automatische Paketinstallation über QEMU Guest Agent"
|
||||||
log "ist in dieser Version absichtlich noch nicht freigeschaltet."
|
log "ist in dieser Version absichtlich noch nicht freigeschaltet."
|
||||||
|
|
||||||
@@ -545,23 +498,10 @@ check_vm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_vm() {
|
update_vm() {
|
||||||
|
|
||||||
local id="$1"
|
local id="$1"
|
||||||
|
|
||||||
# V1 erkennt VMs bereits sauber.
|
|
||||||
# Die tatsächliche Befehlsausführung innerhalb einer VM wird erst
|
|
||||||
# freigeschaltet, nachdem wir die vorhandenen VMs geprüft haben.
|
|
||||||
#
|
|
||||||
# Damit vermeiden wir, bei einer Windows-VM oder einer VM ohne
|
|
||||||
# funktionierenden Guest Agent versehentlich Befehle auszuführen.
|
|
||||||
|
|
||||||
check_vm "$id"
|
check_vm "$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Listen
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
list_lxc() {
|
list_lxc() {
|
||||||
pct list 2>/dev/null |
|
pct list 2>/dev/null |
|
||||||
awk 'NR>1 && $1 ~ /^[0-9]+$/ {print $1}'
|
awk 'NR>1 && $1 ~ /^[0-9]+$/ {print $1}'
|
||||||
@@ -572,10 +512,6 @@ list_vms() {
|
|||||||
awk 'NR>1 && $1 ~ /^[0-9]+$/ {print $1}'
|
awk 'NR>1 && $1 ~ /^[0-9]+$/ {print $1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Start
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
log ""
|
log ""
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
log " Proxmox Guest Updater"
|
log " Proxmox Guest Updater"
|
||||||
@@ -586,10 +522,6 @@ log "Proxmox: $(pveversion)"
|
|||||||
log "Modus: $MODE"
|
log "Modus: $MODE"
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Einzelner CT
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
if [[ -n "$ONLY_CT" ]]; then
|
if [[ -n "$ONLY_CT" ]]; then
|
||||||
|
|
||||||
if ! pct config "$ONLY_CT" >/dev/null 2>&1; then
|
if ! pct config "$ONLY_CT" >/dev/null 2>&1; then
|
||||||
@@ -603,10 +535,6 @@ if [[ -n "$ONLY_CT" ]]; then
|
|||||||
update_lxc "$ONLY_CT"
|
update_lxc "$ONLY_CT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Einzelne VM
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
elif [[ -n "$ONLY_VM" ]]; then
|
elif [[ -n "$ONLY_VM" ]]; then
|
||||||
|
|
||||||
if ! qm config "$ONLY_VM" >/dev/null 2>&1; then
|
if ! qm config "$ONLY_VM" >/dev/null 2>&1; then
|
||||||
@@ -620,28 +548,20 @@ elif [[ -n "$ONLY_VM" ]]; then
|
|||||||
update_vm "$ONLY_VM"
|
update_vm "$ONLY_VM"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Gesamtlauf
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
if [[ "$UPDATE_HOST" == "yes" ]]; then
|
if [[ "$UPDATE_HOST" == "yes" ]]; then
|
||||||
|
|
||||||
if [[ "$MODE" == "check" ]]; then
|
if [[ "$MODE" == "check" ]]; then
|
||||||
check_host
|
check_host
|
||||||
else
|
else
|
||||||
update_host
|
update_host
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
log "Proxmox-Host laut Konfiguration übersprungen."
|
log "Proxmox-Host laut Konfiguration übersprungen."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$UPDATE_LXC" == "yes" ]]; then
|
if [[ "$UPDATE_LXC" == "yes" ]]; then
|
||||||
|
|
||||||
while read -r id; do
|
while read -r id; do
|
||||||
|
|
||||||
[[ -n "$id" ]] || continue
|
[[ -n "$id" ]] || continue
|
||||||
|
|
||||||
if [[ "$MODE" == "check" ]]; then
|
if [[ "$MODE" == "check" ]]; then
|
||||||
@@ -649,17 +569,13 @@ else
|
|||||||
else
|
else
|
||||||
update_lxc "$id"
|
update_lxc "$id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < <(list_lxc)
|
done < <(list_lxc)
|
||||||
|
|
||||||
else
|
else
|
||||||
log "LXC-Updates laut Konfiguration deaktiviert."
|
log "LXC-Updates laut Konfiguration deaktiviert."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$UPDATE_VMS" == "yes" ]]; then
|
if [[ "$UPDATE_VMS" == "yes" ]]; then
|
||||||
|
|
||||||
while read -r id; do
|
while read -r id; do
|
||||||
|
|
||||||
[[ -n "$id" ]] || continue
|
[[ -n "$id" ]] || continue
|
||||||
|
|
||||||
if [[ "$MODE" == "check" ]]; then
|
if [[ "$MODE" == "check" ]]; then
|
||||||
@@ -667,18 +583,12 @@ else
|
|||||||
else
|
else
|
||||||
update_vm "$id"
|
update_vm "$id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < <(list_vms)
|
done < <(list_vms)
|
||||||
|
|
||||||
else
|
else
|
||||||
log "VM-Updates laut Konfiguration deaktiviert."
|
log "VM-Updates laut Konfiguration deaktiviert."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Abschluss
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
log ""
|
log ""
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
log " Ergebnis"
|
log " Ergebnis"
|
||||||
@@ -696,10 +606,6 @@ log "Host Update: $HOST_OK"
|
|||||||
log "Host Reboot nötig: $HOST_REBOOT_REQUIRED"
|
log "Host Reboot nötig: $HOST_REBOOT_REQUIRED"
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Automatischer Host-Neustart
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
|
|
||||||
if [[ -z "$ONLY_CT" \
|
if [[ -z "$ONLY_CT" \
|
||||||
&& -z "$ONLY_VM" \
|
&& -z "$ONLY_VM" \
|
||||||
&& "$MODE" == "update" \
|
&& "$MODE" == "update" \
|
||||||
@@ -709,8 +615,10 @@ if [[ -z "$ONLY_CT" \
|
|||||||
&& "$NO_REBOOT" != "yes" ]]
|
&& "$NO_REBOOT" != "yes" ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
|
if (( ERRORS == 0 )); then
|
||||||
log ""
|
log ""
|
||||||
log "Host-Neustart erforderlich."
|
log "Host-Neustart erforderlich."
|
||||||
|
log "Gesamter Update-Lauf fehlerfrei."
|
||||||
log "Automatischer Neustart in 1 Minute."
|
log "Automatischer Neustart in 1 Minute."
|
||||||
log "Proxmox fährt die laufenden Gäste geordnet herunter."
|
log "Proxmox fährt die laufenden Gäste geordnet herunter."
|
||||||
|
|
||||||
@@ -718,6 +626,11 @@ then
|
|||||||
|
|
||||||
shutdown -r +1 \
|
shutdown -r +1 \
|
||||||
"Proxmox Guest Updater: Neustart nach erfolgreichem Systemupdate"
|
"Proxmox Guest Updater: Neustart nach erfolgreichem Systemupdate"
|
||||||
|
else
|
||||||
|
log ""
|
||||||
|
log "Host-Neustart erforderlich, aber automatischer Neustart wird NICHT ausgeführt."
|
||||||
|
log "Grund: $ERRORS Fehler im Update-Lauf."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( ERRORS > 0 )); then
|
if (( ERRORS > 0 )); then
|
||||||
|
|||||||
Reference in new issue
Block a user