Created
May 21, 2017 17:58
-
-
Save nairby/43cbc3065d15482747229c0ca82193ca to your computer and use it in GitHub Desktop.
Do simple test for connecting to remote service
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/sh | |
logfile=/tmp/test-network.log | |
d=`date` | |
echo -n $d >> $logfile | |
# Check SSH connection to somewhere external | |
for host in ts-b.ucl.ac.uk ts-c.ucl.ac.uk | |
do | |
if nc -zw1 $host 22; then | |
echo -n " $host okay" >> $logfile | |
else | |
echo -n " $host n/a " >> $logfile | |
fi | |
done | |
echo >> $logfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment