Wrap lines at 80 columns where appropriate and I had the energy to think about how/where to wrap. There are still lines longer than that, which I plan to wrap in the future. But that is enough for now.
18 lines
366 B
Bash
Executable File
18 lines
366 B
Bash
Executable File
#!/bin/sh
|
|
|
|
connection="$(nmcli con show --active | awk '$3 ~ /^(vpn|tun)$/ { print $1 }')"
|
|
if [ -n "$connection" ]; then
|
|
echo "VPN: $connection"
|
|
exit 0
|
|
fi
|
|
|
|
# [o] is a hack to not grep the grep-command. See:
|
|
# https://stackoverflow.com/questions/9375711/more-elegant-ps-aux-grep-v-grep
|
|
if ps ax | grep -q "[o]penvpn"; then
|
|
echo "VPN"
|
|
exit 0
|
|
fi
|
|
|
|
echo
|
|
exit 1
|