Scripts for automatically restarting OpenVPN if it becomes unresponsive on Asus Keenetic routers. Tested on models KN-1810 and KN-1811.
ssh root@router_ip
exec sh
- Copy monitor_vpn.sh to /opt/bin/monitor_openvpn. You can just copy-paste code using vi
vi /opt/bin/monitor_openvpn.sh
- Make it executable
chmod +x /opt/bin/monitor_openvpn.sh
- Now make a daemon that will start automaticall on the reboot of the router. Copy S99VPNChecker.sh to /opt/etc/init.d/S99VPNChecker.
vi /opt/etc/init.d/S99VPNChecker
Scripts located in /opt/etc/init.d/ are automatically started when the system boots up if their name begins with S. The number in the name, such as S99, determines the order of startup (the higher the number, the later the process will be started).
- Make it executable
chmod +x /opt/etc/init.d/S99VPNChecker
- Run the daemon (or reboot the router)
/opt/etc/init.d/S99VPNChecker start