vpn 313 B

12345678910111213
  1. #!/bin/bash
  2. INSTANCE="${BLOCK_INSTANCE:-}"
  3. # Check VPN status
  4. GET_VPN=$(ip route get 4.2.2.1 | grep -E -- "tun0|wg0|$INSTANCE" | awk '{ print $3 }')
  5. # Store status
  6. case $GET_VPN in
  7. tun0|wg0|$INSTANCE) echo -e "<span color='#00FF00'>ON</span>\n";;
  8. *) echo -e "<span color='#FFDD00'>OFF</span>\n";;
  9. esac