From b8d281348ef8e9f9b87c4acb2fd8d61c76ecf06c Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Fri, 23 Oct 2026 14:30:21 +0200 Subject: [PATCH] fix(wol-sleeper): wait for the internal address after a wakeup Remote clients reach the backup server over wireguard only on its internal address; waiting for the wakeonlan network address never ended there, so htz.mails and the mseibert nodes had no backup since 2026-01-07. The wait now gives up after ten minutes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RywMtsL8qXG7GDY3MHq9Uh --- bundles/wol-sleeper/metadata.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bundles/wol-sleeper/metadata.py b/bundles/wol-sleeper/metadata.py index 5febaf8..e36657d 100644 --- a/bundles/wol-sleeper/metadata.py +++ b/bundles/wol-sleeper/metadata.py @@ -53,12 +53,18 @@ def wake_command(metadata): mac = metadata.get(f"network/{metadata.get('wol-sleeper/network')}/mac") network = ip_interface(metadata.get(f"network/{metadata.get('wol-sleeper/network')}/ipv4")) waker_command = f"/usr/bin/wakeonlan -i {network.network.broadcast_address} {mac}" + # wait on the internal address: the wakeonlan network is not routed to remote clients (wireguard); + # bounded, so a failed wakeup cannot block the next runs forever + internal_ip = ip_interface(metadata.get('network/internal/ipv4')).ip return { 'wol-sleeper': { 'mac': mac, 'waker_command': waker_command, - 'wake_command': f"ssh -o StrictHostKeyChecking=no wol@{waker_hostname} '{waker_command}' && while ! ping {network.ip} -c1 -W3; do true; done", + 'wake_command': ( + f"ssh -o StrictHostKeyChecking=no wol@{waker_hostname} '{waker_command}'" + f" && timeout 600 sh -c 'until ping -c1 -W3 {internal_ip} > /dev/null; do sleep 2; done'" + ), }, }