I found a solution to this that may benefit others who have the same problem....
First you need to make sure openvpn is keeping its own log, which in my case is /home/share/openvpn-client.log.
then...
Install monit.
In the monit control file I have this:
check file openvpn-client.log with path /home/share/openvpn-client.log
if match "RESOLVE: Cannot resolve host address" then exec "/root/reset.sh"
reset.sh is a little script I wrote to reconnect my vpn but a normal user could replace /root/reset.sh with /etc/init.d/openvpn restart
this solution is working fine and it has already reconnected my vpn twice while I was away from the pc. From the time the vpn tunnel goes down it takes about 2 mins for the above process to get it back up again.
Last edited by tonj; 04-22-2014 at 03:57 AM.
|