VPN status check
parent
8f5ac5b948
commit
13994fa458
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# checks mullvad status for monitoring in polybar
|
||||||
|
|
||||||
|
CONNECTED=$(printf '%s%s' '%{F#0F0}' $(echo -e '\Uf0318')) # green
|
||||||
|
DISCONNECTED=$(printf '%s%s' '%{F#F00}' $(echo -e '\Uf0319')) # red
|
||||||
|
|
||||||
|
# check that its installed
|
||||||
|
if ! command -v mullvad &>/dev/null ; then
|
||||||
|
echo "Seafile not downloaded to device!">&2
|
||||||
|
echo "$DISCONNECTED"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# getting vpn status
|
||||||
|
VPN_DISCONNECTED=$(mullvad status | grep Disconnected)
|
||||||
|
|
||||||
|
if [[ -n "$VPN_DISCONNECTED" ]] ; then
|
||||||
|
# vpn is disconnected
|
||||||
|
echo "$DISCONNECTED"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# connected
|
||||||
|
echo "$CONNECTED"
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue