mirror of
https://github.com/teddysun/across.git
synced 2025-02-07 15:49:36 +08:00
Update bench.sh
This commit is contained in:
parent
56f11d49e4
commit
ed8826fccb
57
bench.sh
57
bench.sh
@ -38,14 +38,6 @@ _exists() {
|
|||||||
return ${rt}
|
return ${rt}
|
||||||
}
|
}
|
||||||
|
|
||||||
_64bit(){
|
|
||||||
if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_exit() {
|
_exit() {
|
||||||
_red "\nThe script has been terminated.\n"
|
_red "\nThe script has been terminated.\n"
|
||||||
# clean up
|
# clean up
|
||||||
@ -169,15 +161,43 @@ ipv4_info() {
|
|||||||
local city="$(wget -q -T10 -O- ipinfo.io/city)"
|
local city="$(wget -q -T10 -O- ipinfo.io/city)"
|
||||||
local country="$(wget -q -T10 -O- ipinfo.io/country)"
|
local country="$(wget -q -T10 -O- ipinfo.io/country)"
|
||||||
local region="$(wget -q -T10 -O- ipinfo.io/region)"
|
local region="$(wget -q -T10 -O- ipinfo.io/region)"
|
||||||
[[ -n "$org" ]] && echo " Organization : $(_blue "$org")"
|
if [[ -n "$org" ]]; then
|
||||||
[[ -n "$city" && -n "country" ]] && echo " Location : $(_blue "$city / $country")"
|
echo " Organization : $(_blue "$org")"
|
||||||
[[ -n "$region" ]] && echo " Region : $(_yellow "$region")"
|
fi
|
||||||
[[ -z "$org" ]] && echo " Region : $(_red "No ISP detected")"
|
if [[ -n "$city" && -n "country" ]]; then
|
||||||
|
echo " Location : $(_blue "$city / $country")"
|
||||||
|
fi
|
||||||
|
if [[ -n "$region" ]]; then
|
||||||
|
echo " Region : $(_yellow "$region")"
|
||||||
|
fi
|
||||||
|
if [[ -z "$org" ]]; then
|
||||||
|
echo " Region : $(_red "No ISP detected")"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_speedtest() {
|
install_speedtest() {
|
||||||
if [ ! -e "./speedtest-cli/speedtest" ]; then
|
if [ ! -e "./speedtest-cli/speedtest" ]; then
|
||||||
_64bit && sys_bit=x86_64 || sys_bit=i386
|
sys_bit=""
|
||||||
|
local sysarch="$(uname -m)"
|
||||||
|
if [ "${sysarch}" = "unknown" ] || [ "${sysarch}" = "" ]; then
|
||||||
|
local sysarch="$(arch)"
|
||||||
|
fi
|
||||||
|
if [ "${sysarch}" = "x86_64" ]; then
|
||||||
|
sys_bit="x86_64"
|
||||||
|
fi
|
||||||
|
if [ "${sysarch}" = "i386" ] || [ "${sysarch}" = "i686" ]; then
|
||||||
|
sys_bit="i386"
|
||||||
|
fi
|
||||||
|
if [ "${sysarch}" = "armv8" ] || [ "${sysarch}" = "armv8l" ] || [ "${sysarch}" = "aarch64" ] || [ "${sysarch}" = "arm64" ]; then
|
||||||
|
sys_bit="aarch64"
|
||||||
|
fi
|
||||||
|
if [ "${sysarch}" = "armv7" ] || [ "${sysarch}" = "armv7l" ]; then
|
||||||
|
sys_bit="armhf"
|
||||||
|
fi
|
||||||
|
if [ "${sysarch}" = "armv6" ]; then
|
||||||
|
sys_bit="armel"
|
||||||
|
fi
|
||||||
|
[ -z "${sys_bit}" ] && _red "Error: Unsupported system architecture (${sysarch}).\n" && exit 1
|
||||||
url1="https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-${sys_bit}.tgz"
|
url1="https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-${sys_bit}.tgz"
|
||||||
url2="https://dl.lamp.sh/files/ookla-speedtest-1.1.1-linux-${sys_bit}.tgz"
|
url2="https://dl.lamp.sh/files/ookla-speedtest-1.1.1-linux-${sys_bit}.tgz"
|
||||||
wget --no-check-certificate -q -T10 -O speedtest.tgz ${url1}
|
wget --no-check-certificate -q -T10 -O speedtest.tgz ${url1}
|
||||||
@ -191,7 +211,7 @@ install_speedtest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_intro() {
|
print_intro() {
|
||||||
echo " $(_yellow "*********************** A Bench.sh Script By Teddysun ***************")"
|
echo "-------------------- A Bench.sh Script By Teddysun -------------------"
|
||||||
echo " Intro : https://teddysun.com/444.html"
|
echo " Intro : https://teddysun.com/444.html"
|
||||||
echo " Version : $(_green v2022-01-01)"
|
echo " Version : $(_green v2022-01-01)"
|
||||||
echo " Usage : $(_red "wget -qO- bench.sh | bash")"
|
echo " Usage : $(_red "wget -qO- bench.sh | bash")"
|
||||||
@ -231,8 +251,12 @@ get_system_info() {
|
|||||||
print_system_info() {
|
print_system_info() {
|
||||||
echo " CPU Model : $(_blue "$cname")"
|
echo " CPU Model : $(_blue "$cname")"
|
||||||
echo " CPU Cores : $(_blue "$cores")"
|
echo " CPU Cores : $(_blue "$cores")"
|
||||||
|
if [ -n "$freq" ]; then
|
||||||
echo " CPU Frequency : $(_blue "$freq MHz")"
|
echo " CPU Frequency : $(_blue "$freq MHz")"
|
||||||
|
fi
|
||||||
|
if [ -n "$ccache" ]; then
|
||||||
echo " CPU Cache : $(_blue "$ccache")"
|
echo " CPU Cache : $(_blue "$ccache")"
|
||||||
|
fi
|
||||||
echo " Total Disk : $(_yellow "$disk_total_size GB") $(_blue "($disk_used_size GB Used)")"
|
echo " Total Disk : $(_yellow "$disk_total_size GB") $(_blue "($disk_used_size GB Used)")"
|
||||||
echo " Total Mem : $(_yellow "$tram MB") $(_blue "($uram MB Used)")"
|
echo " Total Mem : $(_yellow "$tram MB") $(_blue "($uram MB Used)")"
|
||||||
echo " Total Swap : $(_blue "$swap MB ($uswap MB Used)")"
|
echo " Total Swap : $(_blue "$swap MB ($uswap MB Used)")"
|
||||||
@ -286,12 +310,11 @@ print_end_time() {
|
|||||||
echo " Timestamp : $date_time"
|
echo " Timestamp : $date_time"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
! _exists "wget" && _red "Error: wget command not found.\n" && exit 1
|
||||||
! _exists "wget" && _red "Error: wget command not found. You must be install wget command at first.\n" && exit 1
|
! _exists "free" && _red "Error: free command not found.\n" && exit 1
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
check_virt
|
check_virt
|
||||||
clear
|
clear
|
||||||
next
|
|
||||||
print_intro
|
print_intro
|
||||||
next
|
next
|
||||||
get_system_info
|
get_system_info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user