<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Test &#x27;Universelles Update-Skipt &#x2F; Systempflege&#x27;]]></title><description><![CDATA[<p dir="auto">Ich hab mal (mit ein wenig Support seitens der KI 'Le Chat Mistral') ein generelles Update-Skript gebastelt.<br />
Den nachfolgenden Code auf dem System abspeichern und ausführbar machen.</p>
<p dir="auto">Das Skript deckt</p>
<ul>
<li>Paketupdates einer Debian-Installation ab (aber keine Dist-Upgrades/Release-Wechsel!) inkl. nodejs-Updates innerhalb einer Major-Version (aber keine Wechsel der Hauptversion oder Reparaturen daran)</li>
<li>Updates des js-controllers (Das muss am intensivsten getestet werden!)</li>
<li>ioBroker-Adapter-Updates</li>
</ul>
<p dir="auto">ab .</p>
<p dir="auto">Bitte NICHT auf Produktiv-Systemen testen, nur auf ausdrücklichen Test-Systemen, bei denen es 'egal' ist, wenn die über den Jordan gehen.</p>
<pre><code>#!/usr/bin/env bash

# Clear screen
clear

# Check if 'nc' (netcat) is available
if ! command -v nc &amp;&gt; /dev/null; then
    printf "${RED}Error: 'nc' (netcat) is not installed. Please install it with 'sudo apt-get install netcat-openbsd'.${NC}\n"
    exit 1
fi

# Define colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Function to display a progress bar
progress_bar() {
    local duration=${1}
    local columns=$(tput cols)
    local progress_width=$((columns - 10))
    local increment=$((duration * 100 / progress_width))
    local progress=0

    printf " ["
    for ((i=0; i&lt;progress_width; i++)); do
        if [ $((i * increment)) -ge $((progress * duration / 100)) ]; then
            printf "="
            progress=$((progress + 1))
        else
            printf " "
        fi
    done
    printf "] %d%%" $progress
    printf "\r"
}

# Function to stop ioBroker with timeout and progress bar
stop_iobroker() {
    printf "${YELLOW}Stopping ioBroker...${NC}\n"
    iobroker stop &amp;
    local pid=$!
    local timeout=60
    local elapsed=0
    local progress=0

    # Show progress bar while waiting
    while kill -0 $pid 2&gt;/dev/null &amp;&amp; [ $elapsed -lt $timeout ]; do
        progress=$((elapsed * 100 / timeout))
        printf " ["
        for ((i=0; i&lt;20; i++)); do
            if [ $i -lt $((progress / 5)) ]; then
                printf "="
            else
                printf " "
            fi
        done
        printf "] %d%%" $progress
        printf "\r"
        sleep 1
        elapsed=$((elapsed + 1))
    done
    printf "\n"

    if [ $elapsed -ge $timeout ]; then
        printf "${RED}Timeout: ioBroker did not stop within $timeout seconds.${NC}\n"
        kill -9 $pid 2&gt;/dev/null
        return 1
    fi

    # Verify that js-controller is really stopped
    if ! wait_for_js_controller_stop; then
        return 1
    fi
    return 0
}

# Function to wait until js-controller is fully stopped
wait_for_js_controller_stop() {
    printf "${YELLOW}Waiting until js-controller is fully stopped..."
    local timeout=120
    local elapsed=0

    while pgrep -f "iobroker.js-controller" &gt; /dev/null; do
        if [ $elapsed -ge $timeout ]; then
            printf "\n${RED}Timeout: js-controller did not stop within $timeout seconds.${NC}\n"
            return 1
        fi
        printf "."
        sleep 1
        elapsed=$((elapsed + 1))
    done
    printf "${GREEN} Done.${NC}\n"
    return 0
}

# Function to wait until js-controller is fully started
wait_for_js_controller_start() {
    printf "${YELLOW}Waiting until js-controller is fully started..."
    local timeout=120
    local elapsed=0

    while ! pgrep -f "iobroker.js-controller" &gt; /dev/null; do
        if [ $elapsed -ge $timeout ]; then
            printf "\n${RED}Timeout: js-controller did not start within $timeout seconds.${NC}\n"
            return 1
        fi
        printf "."
        sleep 1
        elapsed=$((elapsed + 1))
    done

    # Wait until js-controller is reachable on port 8081
    elapsed=0
    while ! nc -z localhost 8081; do
        if [ $elapsed -ge $timeout ]; then
            printf "\n${RED}Timeout: js-controller did not become reachable within $timeout seconds.${NC}\n"
            return 1
        fi
        printf "."
        sleep 1
        elapsed=$((elapsed + 1))
    done
    printf "${GREEN} Done.${NC}\n"
    return 0
}

# Header
printf "${BLUE}=============================================================================${NC}\n"
printf "${BLUE}===                      System Update Script                             ===${NC}\n"
printf "${BLUE}=============================================================================${NC}\n"
echo ""

# 1. Update package lists
printf "${YELLOW}1. Updating package lists...${NC}\n"
if ! sudo apt-get update -y; then
    printf "${RED}Error: Failed to update package lists.${NC}\n"
    exit 1
fi
printf "${GREEN}Done.${NC}\n"
echo ""

# Check if nodejs needs to be updated
nodejs_update=false
if sudo apt-get --dry-run upgrade | grep -q "nodejs"; then
    nodejs_update=true
fi

# If nodejs needs to be updated, stop ioBroker
if [ "$nodejs_update" = true ]; then
    if ! stop_iobroker; then
        printf "${RED}Error: Failed to stop ioBroker properly.${NC}\n"
        exit 1
    fi
fi

# 2. Perform system upgrade
printf "${YELLOW}2. Performing system upgrade...${NC}\n"
if ! sudo apt-get full-upgrade -y; then
    printf "${RED}Error: System upgrade failed.${NC}\n"
    exit 1
fi
printf "${GREEN}Done.${NC}\n"
echo ""

# If nodejs was updated, start ioBroker
if [ "$nodejs_update" = true ]; then
    printf "${YELLOW}nodejs has been updated. Starting ioBroker...${NC}\n"
    if ! iobroker start; then
        printf "${RED}Error: Failed to start ioBroker.${NC}\n"
        exit 1
    fi
    if ! wait_for_js_controller_start; then
        printf "${RED}Error: ioBroker did not start properly.${NC}\n"
        exit 1
    fi
fi

# 3. Check and install ioBroker updates
printf "${YELLOW}3. Checking for ioBroker updates...${NC}\n"
iobroker update &gt; "/tmp/iobroker_updates.log" 2&gt;&amp;1

# Check if js-controller needs to be updated
if grep -q "js-controller.*Updatable" "/tmp/iobroker_updates.log"; then
    printf "${YELLOW}js-controller needs to be updated. Stopping ioBroker...${NC}\n"
    if ! stop_iobroker; then
        printf "${RED}Error: Failed to stop ioBroker properly.${NC}\n"
        exit 1
    fi

    printf "${YELLOW}Updating js-controller...${NC}\n"
    if ! iobroker upgrade self; then
        printf "${RED}Error: Failed to update js-controller.${NC}\n"
        exit 1
    fi
    printf "${GREEN}Done.${NC}\n"

    printf "${YELLOW}Starting ioBroker...${NC}\n"
    if ! iobroker start; then
        printf "${RED}Error: Failed to start ioBroker.${NC}\n"
        exit 1
    fi
    if ! wait_for_js_controller_start; then
        printf "${RED}Error: ioBroker did not start properly.${NC}\n"
        exit 1
    fi
fi

# Install all other ioBroker updates
printf "${YELLOW}Installing ioBroker updates...${NC}\n"
if ! iobroker upgrade --all; then
    printf "${RED}Error: Failed to install ioBroker updates.${NC}\n"
    exit 1
fi
printf "${GREEN}Done.${NC}\n"
echo ""

# Reboot check
printf "${BLUE}=============================================================================${NC}\n"
if [ -f "/var/run/reboot-required" ]; then
    printf "${RED}IMPORTANT: The system needs to be REBOOTED to complete the changes!${NC}\n"
    echo ""
    printf "${YELLOW}Please execute the following command:${NC}\n"
    printf "${GREEN}sudo reboot${NC}\n"
else
    printf "${GREEN}All updates have been installed successfully. No reboot required.${NC}\n"
fi
printf "${BLUE}=============================================================================${NC}\n"

</code></pre>
<p dir="auto">Auf meinem aktuellen System schaut das dann so aus:</p>
<pre><code>=============================================================================
===                      System Update Script                             ===
=============================================================================

1. Updating package lists...
OK:1 https://cli.github.com/packages stable InRelease
OK:2 http://archive.raspberrypi.com/debian trixie InRelease
OK:3 http://deb.debian.org/debian trixie InRelease                                                                                                                         
OK:4 http://deb.debian.org/debian-security trixie-security InRelease                                                                                                       
OK:5 https://repo.mosquitto.org/debian trixie InRelease                                                                                                                    
OK:6 http://deb.debian.org/debian trixie-updates InRelease                                                                                                                 
OK:7 https://deb.nodesource.com/node_25.x nodistro InRelease                                                                                                               
OK:8 https://deb.nodesource.com/node_22.x nodistro InRelease                                                                
Holen:9 https://pkgs.tailscale.com/stable/debian trixie InRelease                                                          
OK:10 https://packagecloud.io/ookla/speedtest-cli/debian trixie InRelease                          
Es wurden 6.582 B in 1 s geholt (5.191 B/s).
Paketlisten werden gelesen… Fertig
Done.

2. Performing system upgrade...
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Paketaktualisierung (Upgrade) wird berechnet… Fertig
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Done.

3. Checking for ioBroker updates...
Installing ioBroker updates...
All adapters are up to date
Done.

=============================================================================
All updates have been installed successfully. No reboot required.
=============================================================================

</code></pre>
]]></description><link>https://forum.iobroker.net/topic/84353/test-universelles-update-skipt-systempflege</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 21:54:22 GMT</lastBuildDate><atom:link href="https://forum.iobroker.net/topic/84353.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Apr 2026 22:17:28 GMT</pubDate><ttl>60</ttl></channel></rss>