|
|
@ -12,14 +12,17 @@ if ! command -v mullvad &>/dev/null ; then
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# getting vpn status
|
|
|
|
# reading vpn status as continous output
|
|
|
|
VPN_DISCONNECTED=$(mullvad status | grep Disconnected)
|
|
|
|
while read VPN_STATUS; do
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -n "$VPN_DISCONNECTED" ]] ; then
|
|
|
|
VPN_DISCONNECTED=$(echo "$VPN_STATUS" | grep Disconnect);
|
|
|
|
# vpn is disconnected
|
|
|
|
|
|
|
|
echo "$DISCONNECTED"
|
|
|
|
if [[ -n "$VPN_DISCONNECTED" ]] ; then
|
|
|
|
exit 0
|
|
|
|
# vpn is disconnected
|
|
|
|
fi
|
|
|
|
echo "$DISCONNECTED"
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# connected
|
|
|
|
# connected
|
|
|
|
echo "$CONNECTED"
|
|
|
|
echo "$CONNECTED"
|
|
|
|
|
|
|
|
done < <(mullvad status listen)
|
|
|
|