mirror of
https://github.com/teddysun/across.git
synced 2025-01-19 06:19:35 +08:00
update display
This commit is contained in:
parent
e22ab569a6
commit
4dd8008978
31
bench.sh
31
bench.sh
@ -30,36 +30,37 @@ next() {
|
|||||||
printf "%-70s\n" "-" | sed 's/\s/-/g'
|
printf "%-70s\n" "-" | sed 's/\s/-/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
speed_test() {
|
display() {
|
||||||
local speedtest=$(wget -4O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
|
local nodeName=$1
|
||||||
local ipaddress=$(ping -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
|
local ipaddress=$2
|
||||||
local nodeName=$2
|
local speedtest=$3
|
||||||
if [ "${#nodeName}" -lt "8" ]; then
|
if [ "${#nodeName}" -lt "8" ]; then
|
||||||
echo -e "${YELLOW}${nodeName}\t\t\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
echo -e "${YELLOW}${nodeName}\t\t\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
||||||
elif [ "${#nodeName}" -lt "13" ]; then
|
elif [ "${#nodeName}" -lt "13" ]; then
|
||||||
echo -e "${YELLOW}${nodeName}\t\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
echo -e "${YELLOW}${nodeName}\t\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
||||||
|
elif [ "${#nodeName}" -lt "24" -a "${#ipaddress}" -gt "13" ]; then
|
||||||
|
echo -e "${YELLOW}${nodeName}\t\t${GREEN}${ipaddress}\t${RED}${speedtest}${PLAIN}"
|
||||||
elif [ "${#nodeName}" -lt "24" ]; then
|
elif [ "${#nodeName}" -lt "24" ]; then
|
||||||
echo -e "${YELLOW}${nodeName}\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
echo -e "${YELLOW}${nodeName}\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
||||||
|
elif [ "${#nodeName}" -ge "24" -a "${#ipaddress}" -gt "13" ]; then
|
||||||
|
echo -e "${YELLOW}${nodeName}\t${GREEN}${ipaddress}\t${RED}${speedtest}${PLAIN}"
|
||||||
elif [ "${#nodeName}" -ge "24" ]; then
|
elif [ "${#nodeName}" -ge "24" ]; then
|
||||||
echo -e "${YELLOW}${nodeName}\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
echo -e "${YELLOW}${nodeName}\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
speed_test() {
|
||||||
|
local speedtest=$(wget -4O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
|
||||||
|
local ipaddress=$(ping -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
|
||||||
|
local nodeName=$2
|
||||||
|
display ${nodeName} ${ipaddress} ${speedtest}
|
||||||
|
}
|
||||||
|
|
||||||
speed_test_v6() {
|
speed_test_v6() {
|
||||||
local speedtest=$(wget -6O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
|
local speedtest=$(wget -6O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
|
||||||
local ipaddress=$(ping6 -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
|
local ipaddress=$(ping6 -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
|
||||||
local nodeName=$2
|
local nodeName=$2
|
||||||
if [ "${#nodeName}" -lt "8" -a "${#ipaddress}" -eq "13" ]; then
|
display ${nodeName} ${ipaddress} ${speedtest}
|
||||||
echo -e "${YELLOW}${nodeName}\t\t\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
|
||||||
elif [ "${#nodeName}" -lt "13" -a "${#ipaddress}" -eq "13" ]; then
|
|
||||||
echo -e "${YELLOW}${nodeName}\t\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
|
||||||
elif [ "${#nodeName}" -lt "24" -a "${#ipaddress}" -eq "13" ]; then
|
|
||||||
echo -e "${YELLOW}${nodeName}\t\t${GREEN}${ipaddress}\t\t${RED}${speedtest}${PLAIN}"
|
|
||||||
elif [ "${#nodeName}" -lt "24" -a "${#ipaddress}" -gt "13" ]; then
|
|
||||||
echo -e "${YELLOW}${nodeName}\t\t${GREEN}${ipaddress}\t${RED}${speedtest}${PLAIN}"
|
|
||||||
elif [ "${#nodeName}" -ge "24" ]; then
|
|
||||||
echo -e "${YELLOW}${nodeName}\t${GREEN}${ipaddress}\t${RED}${speedtest}${PLAIN}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
speed() {
|
speed() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user