Skip to content

Instantly share code, notes, and snippets.

@neilmayhew
Last active March 10, 2016 17:03
Show Gist options
  • Save neilmayhew/def03b571d66ea44a5e2 to your computer and use it in GitHub Desktop.
Save neilmayhew/def03b571d66ea44a5e2 to your computer and use it in GitHub Desktop.
A script for testing delays on ssh connections
#!/usr/bin/env bash
HOST=${1?}
TOLERANCE=${2-0.1}
while true
do
date
sleep 1
done |
ssh -xa $HOST cat |
while true
do
read -t $(echo | awk "{print 1 + $TOLERANCE}")
if [ $? -gt 128 ]
then
echo "Timeout at $(date +'%F %T %Z')"
fi
done
#!/usr/bin/env bash
SOURCE=$(uname -n)
DEST=${1?}
"$(dirname "$0")"/delay-test.sh "$@" | tee $SOURCE-$DEST-$(date +%F-%H-%M-%S).log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment