当前位置: 首页 > news >正文

用网站做成软件Wordpress自动化

用网站做成软件,Wordpress自动化,搭建网站程序,名风seo软件简介#xff1a; 这篇文章介绍了一款用于Linux系统的自动化硬件老化测试脚本。该脚本能够通过对CPU、内存、硬盘和GPU进行高强度负载测试#xff0c;持续运行设定的时长#xff08;如1小时#xff09;#xff0c;以模拟长时间高负荷运行的环境#xff0c;从而验证硬件的稳…简介 这篇文章介绍了一款用于Linux系统的自动化硬件老化测试脚本。该脚本能够通过对CPU、内存、硬盘和GPU进行高强度负载测试持续运行设定的时长如1小时以模拟长时间高负荷运行的环境从而验证硬件的稳定性与可靠性。脚本还包括了系统资源监控实时显示CPU温度、频率、内存使用情况等信息并将测试结果记录到日志文件中。测试完成后脚本会提供详细的反馈并允许用户选择是否重新执行测试。通过这种方式用户可以轻松地评估设备的性能和健康状况。 #!/bin/bash# 请设置老化时长小时 set_aging_time1# 获取脚本绝对路径 SCRIPT_DIR$(cd $(dirname ${BASH_SOURCE[0]}) pwd) # echo 脚本所在的绝对路径是: ${SCRIPT_DIR}# 日志存放路径 log_file${SCRIPT_DIR}/log_file.log stress_ng${SCRIPT_DIR}/stress_ng.log# 安装stress-ng、figlet和glmark2-es2工具当前环境为Ubuntu系统根据系统替换相关安装命令 install_packages() {if command -v stress-ng /dev/null 21 command -v figlet /dev/null 21 command -v glmark2-es2 /dev/null 21; thenecho All software has been installed.elsesudo apt updatesudo apt install -y stress-ngsudo apt install -y glmark2-es2sudo apt install -y figlet# 检查 stress-ng 是否缺失if ! command -v stress-ng /dev/null 21; thenecho stress-ng is not installedexit 1fi# 检查 figlet 是否缺失if ! command -v figlet /dev/null 21; thenecho figlet is not installedexit 1fi# 检查 glmark2-es2 是否缺失if ! command -v glmark2-es2 /dev/null 21; thenecho glmark2-es2 is not installedexit 1fifi }# CPU stress test run_cpu_test() {# 查看cpu信息 lscpustress-ng --cpu $(nproc) --metrics-brief --timeout ${aging_time}s ${stress_ng} 21 }# Memory stress test run_memory_test() {available_memory$(free -m | grep -E Mem|内存 | awk {print $7})half_memory$(echo $available_memory / $(nproc) | bc)# 运行内存分配释放模式stress-ng --vm $(nproc) --vm-bytes ${half_memory}M --metrics-brief --timeout ${aging_time}s ${stress_ng} 21# 运行内存持续占用模式# stress-ng --vm 1 --vm-bytes ${available_memory}M --metrics-brief --vm-keep --timeout ${aging_time}s ${stress_ng} 21 }#HDD stress test run_disk_stress_test() {stress-ng --hdd $(nproc) -i $(nproc) --metrics-brief --timeout ${aging_time}s ${stress_ng} 21 }# GPU stress test run_gpu_test() {timeout ${aging_time} glmark2-es2 --run-forever --annotate /dev/null 21 }get_cpu_info() {# 当前 CPU 温度路径cpu_temp_path/sys/class/thermal/thermal_zone1/tempcat ${cpu_temp_path} /dev/null 21if [ $? -eq 0 ]; thencpu_temp$(echo scale1; $(cat ${cpu_temp_path}) / 1000 | bc)elsecpu_temp ---fi# 当前 CPU 频率路径cpu_cur_freq_path/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freqcat ${cpu_cur_freq_path} /dev/null 21if [ $? -eq 0 ]; thencpu_cur_freq$(echo scale2; $(cat ${cpu_cur_freq_path}) / 1000 | bc)elsecpu_cur_freq --- fi# 获取当前CPU使用率cpu_usage$(top -bn1 | grep Cpu(s) | sed s/.*, *\([0-9.]*\)%* id.*/\1/ | awk {print 100 - $1}) }get_memory_info() {# 获取总内存、已用内存、缓存memory_info$(free -m)total_mem$(echo $memory_info | grep -E Mem|内存 | awk {print $2})used_mem$(echo $memory_info | grep -E Mem|内存 | awk {print $3})# 计算内存使用百分比保留一位小数used_percent$(echo scale1; $used_mem * 100 / $total_mem | bc) }run_test() {touch ${SCRIPT_DIR}/start_state.zzecho Device MAC: $(ip -o link show up | awk $2 eth0: {print $17}) ${log_file}aging_time$((set_aging_time * 60 * 60))echo Aging duration: ${aging_time}S ${log_file}run_cpu_test run_memory_test run_disk_stress_test run_gpu_test echo start time: $(date) ${log_file}start_time$(date %s)# 清屏clear# 隐藏光标使用 ANSI 转义序列echo -e \e[?25l# 循环直到老化时间结束while true; docurrent_time$(date %s) # 获取当前时间elapsed_time$((current_time - start_time)) # 计算已老化时间# 将已老化时间转换为小时、分钟和秒hours$((elapsed_time / 3600))minutes$(( (elapsed_time % 3600) / 60 ))seconds$((elapsed_time % 60))tput cup 0 0echo -n Aging time: $(printf %02d:%02d:%02d $hours $minutes $seconds) get_cpu_infotput cup 2 0echo -n CPU Usage: ${cpu_usage}% | CPU Temp: ${cpu_temp} °C | CPU Cur Freq: ${cpu_cur_freq} MHz get_memory_infotput cup 4 0echo -n Total Mem: ${total_mem}M | Used Mem: ${used_mem}M | Mem Usage: ${used_percent}% # 检查是否已经达到老化时间if [ $elapsed_time -ge $aging_time ]; thenecho stop time: $(date) ${log_file}breakfi# 每隔1秒更新一次显示sleep 1done# 等待所有测试完成wait# 显示光标使用 ANSI 转义序列echo -e \e[?25h echo printf Aging test passed, aging duration: %02d:%02d:%02d $hours $minutes $seconds 21 | tee -a ${log_file}echo echo -e \033[32m$(figlet PASS)\033[0mtouch ${SCRIPT_DIR}/end_state.zz }install_packagesstart_state${SCRIPT_DIR}/start_state.zz end_state${SCRIPT_DIR}/end_state.zz if [[ -e $start_state ]] [[ ! -e $end_state ]]; thenecho -e \033[31m$(figlet FAIL)\033[0mread -p Aging test failed, please choose whether to re-execute aging test? (y/n): answerif [ $answer Y ] || [ $answer y ]; thenrm -rf ${SCRIPT_DIR}/log_file.logrm -rf ${SCRIPT_DIR}/stress_ng.logrm -rf ${SCRIPT_DIR}/start_state.zzrun_testelseexit 0fielif [[ -e $start_state ]] [[ -e $end_state ]]; thenecho -e \033[32m$(figlet PASS)\033[0mread -p The equipment has completed the aging test and passed. Would you like to re-execute the aging test? (y/n): answerif [ $answer Y ] || [ $answer y ]; thenrm -rf ${SCRIPT_DIR}/log_file.logrm -rf ${SCRIPT_DIR}/stress_ng.logrm -rf ${SCRIPT_DIR}/start_state.zzrm -rf ${SCRIPT_DIR}/end_state.zzrun_testelseexit 0fielserun_test fi
http://www.dnsts.com.cn/news/102100.html

相关文章:

  • 至高建设集团 网站扬州有什么做网站的公司
  • 不想网站备案如何办广州城乡建设网站
  • 专业上海网站建设公司哪家好网站阵地建设
  • 列举免费域名注册的网站广告网站设计公司
  • 沈阳做网站优化托福培训一对一
  • 网站域名免费怎样在百度上发帖子
  • 深圳自适应网站开发公司wordpress多页面模板
  • 中国 网站服务器 租金甘肃张掖网站建设
  • 建设注册中心网站微信网站链接怎么做
  • 赣州做网站j北京app开发公司有哪些
  • 郑州网站建设哪家中国住建部网站查询网
  • 网站优化关键词公司广播电台网站建设方案
  • 请描述网站开发的一般流程个人网站模板素材
  • 网站建设服装项目设计书桂林做手机网站建设
  • 移动端网站建设推广方案建设部注册网站
  • 女装网站建设项目可行性分析上海专业制作网站
  • 做易经类的网站网上做家教兼职哪个网站
  • 常用网站设置如何建立自己的商城
  • 找人做的网站怎么运行外贸网站购买云服务器多少钱
  • 第一站长网厦门网站开发公
  • php网站开发招聘网络营销专业介绍及就业方向
  • 怎么更换网站模板看世界杯网址
  • 手机微网站网站图片类型
  • 企业网站模板湖南岚鸿网站建设是属现代服务吗
  • 聚美优品网站建设分析一支部一品牌一特色方案
  • 如何做自媒体网站创建设计SEO优化象客
  • 免费的网站公司网站asp后台维护
  • wordpress网站配置文件wordpress ishome
  • 绵竹网站建设天津市住房和城乡建设厅网站
  • 做企业网站哪个平台好济南建设监理协会网站