diff options
author | Yuchen Pei <id@ypei.org> | 2024-05-19 18:43:34 +1000 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2024-05-19 18:43:34 +1000 |
commit | a1e0f8e3159fbe91b3caf9e762bdc94906f00181 (patch) | |
tree | ae3240e2b55c7270802f5af7f89eb9d335afd65c /misc/bin | |
parent | 33fdc0bf722c67c31f7c6467bd0dcda64a40b405 (diff) |
[i3status] Check vpn
Have to use read_file because path_exists does not work with path
expansion.
Diffstat (limited to 'misc/bin')
-rwxr-xr-x | misc/bin/check-ovpn.sh | 12 |
1 files changed, 12 insertions, 0 deletions
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 |