This repository has been archived on 2026-07-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
compose-files/scripts/network/mtu_phase1.sh
T

31 lines
1.1 KiB
Bash

#!/bin/bash
# MTU Migration Phase 1 — daemon.json + docker restart
# Args: $1=hostname $2=sync_epoch
HOST=$1
SYNC=$2
LOG=/volume1/docker/mtu_migration/${HOST}_phase1.log
exec >> "$LOG" 2>&1
echo "[$(date)] $HOST waiting for sync epoch $SYNC"
while [ "$(date +%s)" -lt "$SYNC" ]; do sleep 1; done
echo "[$(date)] $HOST SYNC reached"
echo "[$(date)] Writing daemon.json"
cat > /etc/docker/daemon.json << 'DAEMON'
{
"data-root": "/volume1/docker-root/",
"storage-driver": "overlay2",
"dns-search": ["."],
"mtu": 8950
}
DAEMON
echo "[$(date)] daemon.json: $(cat /etc/docker/daemon.json)"
echo "[$(date)] Restarting docker..."
systemctl restart docker
sleep 15
echo "[$(date)] eth0 MTU: $(ip link show eth0 | grep -o 'mtu [0-9]*')"
echo "[$(date)] docker MTU: $(python3 -c "import json; print(json.load(open('/etc/docker/daemon.json')).get('mtu','NOT SET'))")"
sleep 20
echo "[$(date)] Docker status: $(systemctl is-active docker)"
docker node ls 2>&1 || echo "[$(date)] swarm not ready yet"
echo "[$(date)] $HOST phase1 COMPLETE"
touch /volume1/docker/mtu_migration/${HOST}_phase1.done