Some of my OpenWRT routers depend on using a rather unstable wireless connection to reach my OpenVPN server. Although they reconnect very reliably for the most part, sometimes something goes wrong. This is where the watchdog script comes in. It pings the WLAN access point and VPN server every minute. If either one doesn’t respond for a few (configurable) minutes, the watchdog will restart the service. Here’s how it works:


Configuration

First create a new configuration file /etc/config/watchping. This tells the watchdog which hosts to ping and configures the timeout for each service.

At the moment, this script only supports two hard-coded watchdogs. It could be improved to dynamically build multiple instances from the configuration file. Feel free to submit a patch!

The scripts

Create the /usr/lib/watchping folder and upload these scripts:


Final touches

The watchdog script requires „fping“ to be installed on the router:

Check your system log and verify the watchdog started correctly:

Tested with OpenWRT 19.07

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.