You can set up cron to run the script in LuCI:
-
Go to LuCI → System → Startup and make sure that “cron” Initscript is Enabled. If not, then Enable and Start it.
-
Go to LuCI → System → Scheduled Tasks, then enter and save the line -
* * * * * /usr/bin/wireguard_watchdog
-
Go back to LuCI → System → Startup and Restart cron, or just reboot the router
Here is the header comments in the script:
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2018 Aleksandr V. Piskunov <aleksandr.v.piskunov@gmail.com>.
# Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
#
# This watchdog script tries to re-resolve hostnames for inactive WireGuard peers.
# Use it for peers with a frequently changing dynamic IP.
# persistent_keepalive must be set, recommended value is 25 seconds.
#
# Run this script from cron every minute:
# echo '* * * * * /usr/bin/wireguard_watchdog' >> /etc/crontabs/root