vpn: change if to case

This commit is contained in:
Jesús 2021-09-30 12:38:05 -05:00
parent 8ca8321f56
commit 5b22ce6b99
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -3,12 +3,10 @@
INSTANCE="${BLOCK_INSTANCE:-}"
# Check VPN status
GET_VPN=$(ip route | grep -E -- "tun0|$INSTANCE" | awk '{ print $3 }')
GET_VPN=$(ip route | grep -E -- "tun0|wg0|$INSTANCE" | awk '{ print $3 }')
# Store status
if [[ $GET_VPN == *"tun0"* || $GET_VPN == "$INSTANCE" ]]
then
echo -e "<span color='#00FF00'>ON</span>\n"
else
echo -e "<span color='#FFDD00'>OFF</span>\n"
fi
case $GET_VPN in
tun0|wg0|$INSTANCE) echo -e "<span color='#00FF00'>ON</span>\n";;
*) echo -e "<span color='#FFDD00'>OFF</span>\n";;
esac