[Unit] Description=每 10 秒检查一次隧道连接数 [Timer] # 20 秒 -> 10 秒:从"出问题"到"被重启"的等待窗口减半。 # 开机后 45 秒开始第一次(隧道一般几十秒就连上了)。 OnBootSec=45s OnUnitActiveSec=10s AccuracySec=3s Unit=lanremote-watchdog.service [Install] WantedBy=timers.target === [Unit] Description=LanRemote 隧道看门狗(看连接数,不是看公网) After=lanremote-relay.service lanremote-tunnel.service [Service] Type=oneshot ExecStart=/bin/bash /root/lanremote-relay/watchdog.sh MemoryMax=64M StandardOutput=append:/root/lanremote-relay/watchdog.log StandardError=append:/root/lanremote-relay/watchdog.log