1 Star 0 Fork 52

紫枫信息.co/UnifiedDeploymentPlatform

forked from java110/HCDoc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dlurl.sh 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
leojava 提交于 2020-07-11 13:47 . cs
#!/bin/bash
# +-------------------------------------------------------------------
# | HC核心下载加载文件!!
# | Author: 王天良(hecdemo@winqi.cn)。
# +--------------------------------------------------------------------
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
get_node_url(){
nodes=(https://dl.winqi.cn);
i=1;
for node in ${nodes[@]};
do
start=`date +%s.%N`
result=`curl -sS --connect-timeout 3 -m 60 $node/check.txt`
if [ "$result" = 'True' ];then
end=`date +%s.%N`
start_s=`echo $start | cut -d '.' -f 1`
start_ns=`echo $start | cut -d '.' -f 2`
end_s=`echo $end | cut -d '.' -f 1`
end_ns=`echo $end | cut -d '.' -f 2`
time_micro=$(( (10#$end_s-10#$start_s)*1000000 + (10#$end_ns/1000 - 10#$start_ns/1000) ))
time_ms=$(($time_micro/1000))
values[$i]=$time_ms;
urls[$time_ms]=$node
i=$(($i+1))
if [ $time_ms -lt 70 ];then
break;
fi
fi
done
j=5000
for n in ${values[@]};
do
if [ $j -gt $n ];then
j=$n
fi
if [ $j -lt 70 ];then
break;
fi
done
if [ $j = 5000 ];then
NODE_URL='http://dl.winqi.cn';
else
NODE_URL=${urls[$j]}
fi
}
GetPackManager(){
if [ -f "/usr/bin/yum" ] && [ -f "/etc/yum.conf" ]; then
PM="yum"
elif [ -f "/usr/bin/apt-get" ] && [ -f "/usr/bin/dpkg" ]; then
PM="apt-get"
fi
}
GetSysInfo(){
if [ "${PM}" = "yum" ]; then
SYS_VERSION=$(cat /etc/redhat-release)
elif [ "${PM}" = "apt-get" ]; then
SYS_VERSION=$(cat /etc/issue)
fi
SYS_INFO=$(uname -a)
SYS_BIT=$(getconf LONG_BIT)
MEM_TOTAL=$(free -m|grep Mem|awk '{print $2}')
CPU_INFO=$(getconf _NPROCESSORS_ONLN)
GCC_VER=$(gcc -v 2>&1|grep "gcc version"|awk '{print $3}')
CMAKE_VER=$(cmake --version|grep version|awk '{print $3}')
echo -e ${SYS_VERSION}
echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO} gcc:${GCC_VER} cmake:${CMAKE_VER}
echo -e ${SYS_INFO}
}
GetPackManager
if [ ! $NODE_URL ];then
echo '正在连接母站...';
get_node_url
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/fulusco/UnifiedDeploymentPlatform.git
git@gitee.com:fulusco/UnifiedDeploymentPlatform.git
fulusco
UnifiedDeploymentPlatform
UnifiedDeploymentPlatform
master

搜索帮助