20 lines
589 B
Plaintext
Raw Normal View History

2020-08-17 19:29:27 +02:00
#!/bin/sh
user="abocken@student-net.ethz.ch"
password_path="ETH/VPN"
2020-10-03 09:06:25 +02:00
if [ "$1" = "status" ]; then
2020-10-04 15:45:07 +02:00
ping -c 2 -W 3 -q webprint.ethz.ch > /dev/null && printf '🔬'
2020-10-03 09:06:25 +02:00
printf '\n'
2020-08-17 19:29:27 +02:00
else
2020-10-03 09:06:25 +02:00
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
notify-send "ETH VPN" "ETH VPN connected"
fi
else
if ping -c 1 -W 2 -q webprint.ethz.ch ;then
sudo pkill openconnect && notify-send "ETH VPN" "ETH VPN disconnected"
fi
fi
2020-10-04 15:45:07 +02:00
pkill -RTMIN+9 dwmblocks
2020-08-17 19:29:27 +02:00
fi