黑群晖显示真实的CPU型号和自定义CPU型号
- 修改脚本
- 执行脚本
- 自定义显示的CPU型号
脚本的仓库地址:✈
修改脚本
我的CPU型号是N100,这里因为架构识别有问题,所有CPU的型号后面会带一个UnKnown,感觉很别扭,所有修改了下脚本
if [ "$cpu_family" == "N100" ]
thencpu_series=""
fi
if [ "$cpu_series" == "ES" ] || [ "$cpu_series" == "Unkown" ]|| [ "$cpu_series" == "" ]
then
if [ "$cpu_family" == "N100" ]
thencpu_detail="<a href='https:\/\/ark.intel.com\/content\/www\/us\/en\/ark\/products\/231803\/intel-processor-n100-6m-cache-up-to-3-40-ghz.html' target=_blank>详情<\/a>"
else cpu_detail="<a href='https:\/\/ark.intel.com\/content\/www\/us\/en\/ark.html' target=_blank>find<\/a>"
fi
执行脚本
把修改好的脚本上传到群晖的文件夹里面,然后启用群晖的ssh
依次输入以下下命令
cd /volume1/上传到的目录
sudo ./ch_cpuinfo.sh
然后根据提示输入即可
执行完成后,退出群晖的网页端,重新登录即可看到CPU信息了
自定义显示的CPU型号
先确定自己的CPU型号,这里可以在ssh中用以下命令获取
cat /proc/cpuinfo | grep model | grep name | sort -u | awk '{ for(i = 1; i < NF; i++) if ($i ~ /^Intel/) { for(j=i;j<=NF;j++)printf("%s ", $j);printf("\n") }}' | awk -F@ '{ print $1 }' | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/ CPU//g" | awk '{print $2}' | head -1 | sed "s/ *$//g"
然后修改代码,这里我把N100改成了i9 14900K
if [ "$cpu_family" == "N100" ]
thencpu_detail="<a href='https:\/\/ark.intel.com\/content\/www\/us\/en\/ark\/products\/236773\/intel-core-i9-processor-14900k-36m-cache-up-to-6-00-ghz.html' target=_blank>详情<\/a>"cpu_info=`echo "${dt}.cpu_vendor=\"${cpu_vendor}\",${dt}.cpu_family=\"i9 14900K\",${dt}.cpu_series=\"${cpu_series}\",${dt}.cpu_cores=\"${cpu_cores}\",${dt}.cpu_detail=\"${cpu_detail}\","`
elsecpu_info=`echo "${dt}.cpu_vendor=\"${cpu_vendor}\",${dt}.cpu_family=\"${cpu_family}\",${dt}.cpu_series=\"${cpu_series}\",${dt}.cpu_cores=\"${cpu_cores}\",${dt}.cpu_detail=\"${cpu_detail}\","`
fi
改好以后,上传并替换掉之前的脚本,然后执行,根据提示输入,完成后重新登录网页端