JohnnyGrey86

openvpn_check

Aug 12th, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. ## This script checks to see if the tun0 device exists within the transmission jail. If not, it restarts OpenVPN. I have this run as a CRON job every 20 minutes.
  2. currentDate=$(date "+%b %d %H:%M:%S")
  3.  
  4. if iocage exec transmission ifconfig | grep -c "tun0" > /dev/null
  5. then
  6.     echo "$currentDate VPN Check Successful. OpenVPN is still running." >> /var/log/messages
  7. else
  8.     echo "$currentDate VPN Connection is down. Restarting OpenVPN." >> /var/log/messages
  9.     iocage exec transmission service openvpn restart
  10. fi
Advertisement
Add Comment
Please, Sign In to add comment