Tag Archives: restart

VPN restarter script

put in crontab job:
*/10 * * * * root /root/check_vpn.sh

create script:
cat > /root/check_vpn.sh

1
2
3
4
5
6
7
8
9
#!/bin/bash
VPN_HOST=10.254.254.1
/bin/ping -c1 $VPN_HOST > /dev/null;
if [ $? -eq 0 ]; then
  exit;
else
  /bin/killall -9 openvpn;
  /etc/init.d/openvpn start;
fi