diff options
-rw-r--r-- | misc/.config/i3status/config | 8 | ||||
-rwxr-xr-x | misc/bin/check-ovpn.sh | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/misc/.config/i3status/config b/misc/.config/i3status/config index a276e19..4b7725a 100644 --- a/misc/.config/i3status/config +++ b/misc/.config/i3status/config @@ -13,6 +13,7 @@ general { order += "read_file emms" order += "wireless _first_" +order += "read_file VPN" order += "battery all" order += "disk /" order += "disk /home" @@ -38,6 +39,13 @@ ethernet _first_ { format_down = "E: down" } +# in collaboration with check-ovpn.sh +read_file VPN { + format = "VPN: %content" + format_bad = "VPN: NO" + path = "~/.local/ovpn-up" +} + battery all { format = "%status %percentage %remaining" } diff --git a/misc/bin/check-ovpn.sh b/misc/bin/check-ovpn.sh new file mode 100755 index 0000000..fe5d576 --- /dev/null +++ b/misc/bin/check-ovpn.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Check that the vpn is up. Check every 5 seconds for 11 times - for +# use as a minutely cron task +for i in $(seq 1 11); do + if ifconfig tun0 | grep -q "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00"; then + echo YES > ~/.local/ovpn-up + else + rm -f ~/.local/ovpn-up + fi + sleep 5 +done |