added status output to ethvpn

This commit is contained in:
Alexander Bocken 2020-10-03 09:06:25 +02:00
parent e7db5a5ee3
commit b01ee492db
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

View File

@ -1,6 +1,10 @@
#!/bin/sh
user="abocken@student-net.ethz.ch"
password_path="ETH/VPN"
if [ "$1" = "status" ]; then
ping -c 2 -q webprint.ethz.ch > /dev/null && printf '🔬'
printf '\n'
else
if [ $(pgrep -c openconnect) -eq 0 ]; then
pass "$password_path" | sudo openconnect -g student-net -u "$user" --passwd-on-stdin sslvpn.ethz.ch &
if ping -c 4 -W 6 -q webprint.ethz.ch ;then
@ -11,3 +15,4 @@ else
sudo pkill openconnect && notify-send "ETH VPN" "ETH VPN disconnected"
fi
fi
fi