diff --git a/70-vpn-active b/70-vpn-active index b430390..9bf81b1 100755 --- a/70-vpn-active +++ b/70-vpn-active @@ -1,13 +1,14 @@ #!/bin/bash export LANG='en_US.UTF-8' +STATUS=/var/log/openvpn/openvpn-status.log echo "" -echo "Active OVPN clienst:" -mapfile -t common < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $2}') -mapfile -t virtual < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $4}') -mapfile -t sent < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $6}') -mapfile -t received < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $5}') -mapfile -t connected < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g; s/(Mon_|Tue_|Wed_|Sat_|Thu_|Sat_|Sun_)//g ; s/:[0-9][0-9]_/_/g' | grep ^CLIENT_LIST| sort | awk '{print $7}') +echo "Active OVPN clients:" +mapfile -t common < <(sudo tail -n +4 ${STATUS} | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $2}') +mapfile -t virtual < <(sudo tail -n +4 ${STATUS} | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $4}') +mapfile -t sent < <(sudo tail -n +4 ${STATUS} | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $6}') +mapfile -t received < <(sudo tail -n +4 ${STATUS} | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $5}') +mapfile -t connected < <(sudo tail -n +4 ${STATUS} | ssed -R 's/\s+/_/g ; s/,/ /g; s/(Mon_|Tue_|Wed_|Sat_|Thu_|Sat_|Sun_)//g ; s/:[0-9][0-9]_/_/g' | grep ^CLIENT_LIST| sort | awk '{print $7}') out2="Common Name,Virtual Address,Connected Since,▼,▲\n" for k in "${!common[@]}"; do if [ "${common[k]}" != "UNDEF" ]; then