vicf

testing shufshark vpn server status bash script

May 23rd, 2020
2,055
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. dead=0
  3. live=0
  4. today=$(date +%Y%m%d)
  5. log="shufshark.log-$today"
  6. howmany=$(ls -l *udp.ovpn | wc -l)
  7.  
  8.  
  9. while read -r i ; do
  10.     vpnip=$(awk '/^remote /{print $2}' $i)
  11.     ping -w3 "$vpnip" | tee -a "$log"
  12.     RET=$?
  13.    
  14.     if [ $RET -gt 0 ] ; then
  15.         ((dead += 1))
  16.     else
  17.         ((live += 1))
  18.     fi
  19.     echo "" | tee -a "$log"
  20.     echo "" | tee -a "$log"
  21. done < <(ls -l *udp.ovpn | awk '{print $NF}')
  22.  
  23. echo "Total: $howmany server" | tee -a "$log"
  24. echo "Dead: $dead" | tee -a "$log"
  25. echo "Live: $live" | tee -a "$log"
  26.  
  27. exit 0
RAW Paste Data