sg-vpn-check.sh 304 B

123456789101112131415
  1. #!/bin/bash
  2. ## check if SG openvpn connection is established:
  3. ## have 10.4.0.0 network
  4. ## can ping 10.4.0.1 host
  5. ## timeout after 60 seconds
  6. while ! grep -q '0A040000' /proc/net/route; do
  7. [[ $COUNT -le 10 ]] || exit 1
  8. sleep 1
  9. let COUNT++
  10. done
  11. ping -q -c1 -w5 10.4.0.1 &>/dev/null || exit 2