Last active
January 10, 2016 16:06
-
-
Save steren/5585b54bb9e6b403a955 to your computer and use it in GitHub Desktop.
ping every 30 sec and store result in a file, used to diagnose internet connection
This file contains hidden or 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 | |
FILE=$(echo pingstats-$(date '+%Y-%m-%d-%H-%M').csv) | |
echo "datetime,min,avg,max,stddev" > ${FILE} | |
while true | |
do | |
NOW=$(date -u +"%Y-%m-%d %H:%M:%S") | |
# retrieve data from ping: min,avg,max,stddev | |
VALUES=$(ping -c 4 steren.fr | tail -1 | awk '{print $4}' | sed 's/\//,/g') | |
echo "${NOW},${VALUES}" >> ${FILE} | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment