-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_speedtest.sh
76 lines (64 loc) · 1.75 KB
/
run_speedtest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
#
# Execution parameters:
#
# ./run_speedtest.sh --dc_id=US-RDU-1 --tenant_id=1f010a6961b644979e03285671f2f9a0 --project_id=CIS-DCOS-DCOS-RDU-DEMO-01 --host_name=mesos-slave-02 --log_file_location="./CIS-DCOS-DCOS-RDU-DEMO-01.log" --sleep_duration=10s
#
#
sleepDuration=30s
logFileLocation="speedtest.log"
for i in "$@"
do
case $i in
--dc_id=*)
dcID="${i#*=}"
shift # past argument=value
;;
--tenant_id=*)
tenantID="${i#*=}"
shift # past argument=value
;;
--project_id=*)
projectID="${i#*=}"
shift
;;
--host_name=*)
hostName="${i#*=}"
shift
;;
--log_file_location=*)
logFileLocation="${i#*=}"
shift
;;
--sleep_duration=*)
sleepDuration="${i#*=}"
shift
;;
--default)
DEFAULT=YES
shift
;;
*)
# unknown option
;;
esac
done
echo "DCID = ${dcID}"
echo "TENANT_ID = ${tenantID}"
echo "PROJECT_ID = ${projectID}"
echo "HOST_NAME = ${hostName}"
if [ ! -e $logFileLocation ]
then
echo "DCID, TENANT_ID, PROJECT_ID, HOST_NAME, DATE,TIME,PING ms,DL mb/s,UL mb/s" > $logFileLocation
fi
echo "[run_speedtest.sh]: Starting infinite run loop, sleep for $sleepDuration between tests"
echo "[run_speedtest.sh]: Press Ctrl-C to stop"
echo "[run_speedtest.sh]: Writing log to $logFileLocation"
while [ 1 ]; do
echo "[run_speedtest.sh]: Running single test..."
echo -n "$dcID,$tenantID,$projectID,$hostName," >> $logFileLocation
./speedtest.sh --log $logFileLocation --verbose --simple > /dev/null
echo "[run_speedtest.sh]: DONE single test"
echo "[run_speedtest.sh]: Sleeping for $sleepDuration..."
sleep $sleepDuration
done