-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeasure_network.sh
34 lines (25 loc) · 911 Bytes
/
measure_network.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
#!/bin/bash
# Check if a file name argument is provided
if [ $# -le 1 ]; then
echo "Usage: $0 <c/s (client or server)> <output_file> <server IP (if client)>"
exit 1
fi
# Assign the first argument to the output_file variable
role=$1
output_file=$2
server_ip=$3
if [[ "$role" == "c" ]]; then
# Run the iperf3 server and write the output to the specified file
echo "Starting iperf3 client..."
echo "Output is being written to $output_file"
iperf3 -c $server_ip -i 1 -V -t 30 2>&1 | tee -a $output_file
iperf3 -c $server_ip -i 1 -V -u -b 10M -t 30 2>&1 | tee -a $output_file
elif [[ "$role" == "s" ]]; then
# Run the iperf3 server and write the output to the specified file
echo "Starting iperf3 server..."
iperf3 -s -V 2>&1 | tee $output_file
echo "Output is being written to $output_file"
else
echo "Input either 'c' or 's' as first argument"
exit 1
fi