Last active
July 18, 2016 09:18
-
-
Save acsrujan/8e6d005023c6740ab0ab93db52cc0aa8 to your computer and use it in GitHub Desktop.
Script to test connection of a host, port and print time taken for each connection. Output is STDOUT.
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 | |
START=`date +%s` | |
while [ $(( $(date +%s) - 30 )) -lt $START ]; do | |
{ time nc -zw30 <host ip> <port>;} |& grep real | awk '{print $2}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment