-
-
Save groovytron/365a193532c71f46f5ba5f484b89d555 to your computer and use it in GitHub Desktop.
connecting to HE-Arc vpn
This file contains 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