add speed test

This commit is contained in:
tianyu 2015-07-20 10:17:32 +08:00
parent 25b94c17dc
commit 296c0701c1
1 changed files with 27 additions and 0 deletions

27
speedtest/speedtest.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
EMAIL="YOUR_EMAIL@example.com"
NAME="speedtest"
EVENT="finished"
OUTPUT=/tmp/wget.speedtest
TEST_FILES=(
https://node1.example.com/10meg.test
https://node2.example.com/10meg.test
https://node3.example.com/10meg.test
https://node4.example.com/10meg.test
https://node5.example.com/10meg.test
)
# speed test
if [ -f $OUTPUT ]; then
rm $OUTPUT
fi
for file in ${TEST_FILES[@]}; do
timeout 5 wget -4 -O /dev/null $file -a $OUTPUT
echo -e "\n\n#######################\n" >>$OUTPUT
done
# send email
curl -s --http1.0 https://www.xdty.org/mail_extra.php -X POST -d "event=$EVENT&name=$NAME&email=$EMAIL" --data-urlencode extra@$OUTPUT --capath /etc/ssl/certs/