Watchcat Lacking Features

I have a unique setup for my OpenWRT router...

I use ExpressVPN to connect to a public WiFi and secure my network traffic. Occasionally my wifi trunk fails, and watchcat will detect ping loss to 4.4.4.4 and reset my router after 2 mins (2 mins is about the minimum safe downtime to not get stuck in a bootloop before my router reconnects to wifi)... The problem is I only really need to disable and re-enable my wifi connection. Which would provide much less downtime as I could reduce the downtime to seconds. Is anyone aware of any scripting or advanced watchcat features that would detect and reset my wifi and not my whole router?

I don't know watchcat, but you can reset the wireless using

# wifi --help
Usage: /sbin/wifi [config|up|down|reload|status]
enables (default), disables or configures devices not yet configured.

That package does not seem to be configurable, and will always reboot the device. However, it looks like it would take five minutes to modify the script to restart the wifi instead.

2 Likes

this is the watchcat script running in your device https://github.com/openwrt/packages/blob/master/utils/watchcat/files/watchcat.sh

you can find it in /usr/bin/watchcat.sh in your device, you can connect through ssh terminal and edit it.
installing "nano" editor in the device will be useful as it has a more intuitive interface, while default editor (vi) is hard to use.

comment out or delete the content of shutdown_now() function and replace it with your own payload console commands. That's the code that is executed when it decides it is time to reboot the device.

The following is an example that might work.

shutdown_now() {
#restart WAN interface
ifup wan 
#restart wifi radio (ifup wan does not restart correctly wifi on its own, so always use wifi up after it)
wifi up
}
2 Likes