Files
dao_hades/servers/hestia/dao/scripts/wg0_keepalive.sh
2025-12-07 17:31:31 +00:00

20 lines
313 B
Bash
Executable File

#!/bin/bash
# Check if WireGuard tunnel is up, restart if down
PING=/bin/ping
SERVICE=/usr/bin/systemctl
tries=0
while [[ $tries -lt 3 ]]
do
if $PING -c 1 10.10.10.1 &> /dev/null
then
exit 0
fi
tries=$((tries+1))
sleep 2
done
# Failed 3 times, restart
$SERVICE restart wg-quick@wg0