diff --git a/bibVPN.sh b/bibVPN.sh index 6cc2a66..c72b748 100755 --- a/bibVPN.sh +++ b/bibVPN.sh @@ -131,7 +131,7 @@ else fi # A command that will result in your VPN password. -GET_VPN_PASSWORD="security find-generic-password -g -a $VPN_USERNAME 2>&1 >/dev/null | cut -d'\"' -f2" +GET_VPN_PASSWORD="security find-generic-password -w -l openconnect -a $VPN_USERNAME 2>&1" # Command to determine if VPN is connected or disconnected VPN_CONNECTED="ifconfig | egrep -A1 '$NET_FILTER' |cut -d' ' -f2" # Command to run to disconnect VPN @@ -269,7 +269,13 @@ if [ -f $OC_PIDFILE ]; then aUser=$(ps -ef | grep -e '--user\ ' | cut -d' ' -f 32) if [[ $aUser =~ .*@.* ]]; then echo "User: $aUser" ; fi echo "IP: $IP" - echo "Verbunden seit: $(stat $OC_PIDFILE | cut -d'"' -f4)" + pidTime=$(stat $OC_PIDFILE | cut -d'"' -f4) + + + startZeit=$(date -j -f "%b %d %H:%M:%S %Y" "$pidTime" +%s) + now=$(date +%s) + seitZeit="$(( (now-startZeit) ))" + echo "Verbunden seit: $pidTime ($seitZeit Sek ~ $(( seitZeit/60 )) Min) " showSettings exit else