Skip to content
Snippets Groups Projects
Commit 98896d3e authored by Michael Blaschek's avatar Michael Blaschek :bicyclist:
Browse files

updated some connection tools

parent afc1732f
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
# # By Michael Blaschek
# Date 15.08.2020
# CC BY 4.0 International
# University of Vienna, Austria
# Description:
# Add custom VNC resolution # Add custom VNC resolution
# Author: M Blaschek
# Date: 08-2020
# Requires: xrandr and a running VNC session # Requires: xrandr and a running VNC session
if [ $# -lt 2 ]; then
if [ $# -ne 2 ]; then
echo "e.g. try: $0 1920 1380" echo "e.g. try: $0 1920 1380"
echo "or 2560 1320" echo "or 2560 1320"
else else
command=$(cvt $1 $2 60 | grep Modeline | awk '{for(i=3;i<NF;i++){printf "%s ",$i}}') refresh=60
if [ $# -eq 3 ]; then
refresh=$3
fi
command=$(cvt $1 $2 $refresh | grep Modeline | awk '{for(i=3;i<NF;i++){printf "%s ",$i}}')
xrandr --newmode "$1x$2" ${command/Modeline/} xrandr --newmode "$1x$2" ${command/Modeline/}
xrandr --addmode VNC-0 "$1x$2" xrandr --addmode VNC-0 "$1x$2"
xrandr -d $DISPLAY -s "$1x$2" xrandr -d $DISPLAY -s "$1x$2"
......
File moved
#!/bin/bash
# By Michael Blaschek
# Date 23.03.2021
# CC BY 4.0 International
# University of Vienna, Austria
# Description:
# Connect to VPN from the University of Vienna
# Watch connection
if [ -n $VPN_USER ]; then
echo "set VPN_USER to your u:account username"
exit 1
fi
f5fpc -h 2> /dev/null 1>/dev/null
if [ $? -ne 0 ]; then
echo "[VPN] Install Big-IP Edge Client. f5fpc missing"
exit 1
fi
if [ $# -eq 0 ]; then
echo "[VPN] Connecting split-tunnel ..."
f5fpc -s -t vpn.univie.ac.at -u ${VPN_USER}
else
echo "[VPN] Connecting full-tunnel ..."
f5fpc -s -t vpn.univie.ac.at:8443 -u ${VPN_USER}
fi
# Show status
watch -n 10 'f5fpc --info'
echo "[VPN] Shutting down ..."
# Disconnect
f5fpc -o
\ No newline at end of file
#!/bin/bash
# By Michael Blaschek
# Date 23.03.2021
# CC BY 4.0 International
# University of Vienna, Austria
# Description:
# Connect a mount point from a remote server
CURRENT_MOUNTS=$HOME/.currentmounts
check(){
status=0
if [ -f ${CURRENT_MOUNTS} ]; then
# check mount points
while read line;
do
local_dir=$(echo "$line" | cut -d" " -f3)
mount | grep $local_dir > /dev/null
if [ $? -eq 0 ]; then
status=1
echo "$line" >> ${CURRENT_MOUNTS}.2
echo "[CHECK] $local_dir [OK]"
else
echo "[CHECK] $local_dir [X]"
fi
done < ${CURRENT_MOUNTS}
mv ${CURRENT_MOUNTS}.2 ${CURRENT_MOUNTS}
fi
return $status
}
fun_unmount(){
if [ $# -eq 0 ]; then
# unmount everything
if [ -f ${CURRENT_MOUNTS} ]; then
# check mount points
# need to redirect file input to unit-3, so that STDIN is available for read again
while read line <&3;
do
local_dir=$(echo "$line" | cut -d" " -f3)
fun_unmount ${local_dir}
done 3<${CURRENT_MOUNTS}
rm ${CURRENT_MOUNTS}
fi
else
mount | grep $1 > /dev/null
if [ $? -eq 0 ]; then
local_dir=$(mount | grep $1 | tail -n1 | cut -d" " -f3)
read -p "[UNMOUNT] ${local_dir} (y/n)?" REPLY
case "$REPLY" in
Y*|y*) fusermount -u ${local_dir}; echo "[UNMOUNT] ${local_dir} [OK]";;
*) echo "[UNMOUNT] ${local_dir} [X]";;
esac
fi
fi
}
fun_mount(){
# Make directory
mkdir -p $3
# Mount using sshfs
sshfs $1:$2 $3
echo "$1 $2 $3" >> ${CURRENT_MOUNTS}
echo "[MOUNT] $3 [OK]"
}
#
# Check if a mount point is active ?
#
sshfs -h 2> /dev/null 1> /dev/null
if [ $? -ne 0 ]; then
echo "[MOUNT] sshfs is required to be installed."
exit 0
fi
if [ $# -ne 3 ]; then
check
if [ $? -eq 0 ]; then
echo "mountserver [host] [remotedir] [localdir]"
exit 1
fi
echo "[MOUNT] unmounting ..."
# unmount ?
fun_unmount
else
# mount
host=$1
host_dir=$2
local_dir=$3
fun_unmount ${local_dir}
read -p "[MOUNT] ${local_dir} (y/n)?" REPLY
case "$REPLY" in
Y*|y*) fun_mount $host $host_dir $local_dir;;
*) exit 0;;
esac
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment