Update comments

Format shell script by shfmt;
Changed some test servers.

Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
Teddysun 2023-10-16 11:16:51 +09:00
parent 9bc6ce3b98
commit 0a5d50b537
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D

View File

@ -77,11 +77,11 @@ speed() {
speed_test '24215' 'Paris, FR'
speed_test '28922' 'Amsterdam, NL'
speed_test '24447' 'Shanghai, CN'
speed_test '26352' 'Nanjing, CN'
speed_test '27594' 'Guangzhou, CN'
speed_test '5530' 'Chongqing, CN'
speed_test '60572' 'Guangzhou, CN'
speed_test '32155' 'Hongkong, CN'
speed_test '6527' 'Seoul, KR'
speed_test '7311' 'Singapore, SG'
speed_test '23647' 'Mumbai, IN'
speed_test '13623' 'Singapore, SG'
speed_test '21569' 'Tokyo, JP'
}
@ -240,19 +240,37 @@ get_system_info() {
ccache=$(awk -F: '/cache size/ {cache=$2} END {print cache}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')
cpu_aes=$(grep -i 'aes' /proc/cpuinfo)
cpu_virt=$(grep -Ei 'vmx|svm' /proc/cpuinfo)
tram=$( LANG=C; free | awk '/Mem/ {print $2}' )
tram=$(
LANG=C
free | awk '/Mem/ {print $2}'
)
tram=$(calc_size $tram)
uram=$( LANG=C; free | awk '/Mem/ {print $3}' )
uram=$(
LANG=C
free | awk '/Mem/ {print $3}'
)
uram=$(calc_size $uram)
swap=$( LANG=C; free | awk '/Swap/ {print $2}' )
swap=$(
LANG=C
free | awk '/Swap/ {print $2}'
)
swap=$(calc_size $swap)
uswap=$( LANG=C; free | awk '/Swap/ {print $3}' )
uswap=$(
LANG=C
free | awk '/Swap/ {print $3}'
)
uswap=$(calc_size $uswap)
up=$(awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d days, %d hour %d min\n",a,b,c)}' /proc/uptime)
if _exists "w"; then
load=$( LANG=C; w | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//' )
load=$(
LANG=C
w | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//'
)
elif _exists "uptime"; then
load=$( LANG=C; uptime | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//' )
load=$(
LANG=C
uptime | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//'
)
fi
opsy=$(get_opsy)
arch=$(uname -m)
@ -262,9 +280,15 @@ get_system_info() {
echo ${arch} | grep -q "64" && lbit="64" || lbit="32"
fi
kern=$(uname -r)
disk_total_size=$( LANG=C; df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap --total 2>/dev/null | grep total | awk '{ print $2 }' )
disk_total_size=$(
LANG=C
df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap --total 2>/dev/null | grep total | awk '{ print $2 }'
)
disk_total_size=$(calc_size $disk_total_size)
disk_used_size=$( LANG=C; df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap --total 2>/dev/null | grep total | awk '{ print $3 }' )
disk_used_size=$(
LANG=C
df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap --total 2>/dev/null | grep total | awk '{ print $3 }'
)
disk_used_size=$(calc_size $disk_used_size)
tcpctrl=$(sysctl net.ipv4.tcp_congestion_control | awk -F ' ' '{print $3}')
}
@ -322,11 +346,11 @@ print_io_test() {
io3=$(io_test ${writemb})
echo " I/O Speed(3rd run) : $(_yellow "$io3")"
ioraw1=$(echo $io1 | awk 'NR==1 {print $1}')
[ "`echo $io1 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw1=$( awk 'BEGIN{print '$ioraw1' * 1024}' )
[ "$(echo $io1 | awk 'NR==1 {print $2}')" == "GB/s" ] && ioraw1=$(awk 'BEGIN{print '$ioraw1' * 1024}')
ioraw2=$(echo $io2 | awk 'NR==1 {print $1}')
[ "`echo $io2 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw2=$( awk 'BEGIN{print '$ioraw2' * 1024}' )
[ "$(echo $io2 | awk 'NR==1 {print $2}')" == "GB/s" ] && ioraw2=$(awk 'BEGIN{print '$ioraw2' * 1024}')
ioraw3=$(echo $io3 | awk 'NR==1 {print $1}')
[ "`echo $io3 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw3=$( awk 'BEGIN{print '$ioraw3' * 1024}' )
[ "$(echo $io3 | awk 'NR==1 {print $2}')" == "GB/s" ] && ioraw3=$(awk 'BEGIN{print '$ioraw3' * 1024}')
ioall=$(awk 'BEGIN{print '$ioraw1' + '$ioraw2' + '$ioraw3'}')
ioavg=$(awk 'BEGIN{printf "%.1f", '$ioall' / 3}')
echo " I/O Speed(average) : $(_yellow "$ioavg MB/s")"