Created
February 20, 2020 11:31
-
-
Save greut/d5b1d72be9b3193372c7e223f639dae8 to your computer and use it in GitHub Desktop.
connecting to HE-Arc vpn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME=yoan.blanc | |
PASSWORD="..." | |
GID=100 | |
DIRS="ORG" | |
PID=openconnect.pid | |
echo "Welcome to HE-ARC" | |
echo "" | |
echo "$PASSWORD" | sudo openconnect vpnclust1.he-arc.ch -u $USERNAME \ | |
-b --pid-file $PID --passwd-on-stdin | |
for dir in $DIRS; do | |
echo sudo mount -t cifs "//intra.he-arc.ch/${dir}" "intranet/${dir}" \ | |
-o "username=${USERNAME},password=${PASSWORD},uid=${UID},gid=${GID}" | |
echo "Mounted intranet/${dir}" | |
done | |
cleanup () { | |
for dir in $DIRS; do | |
echo sudo umount "intranet/${dir}" | |
done | |
sudo kill `cat ${PID}` | |
echo "Bye bye!" | |
exit 0 | |
} | |
echo "" | |
echo press "Ctrl-C" to close | |
trap cleanup SIGINT | |
# main loop | |
while true; do read x; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment