#!/bin/bash
output=./cpu.log
while true
do
date >> $output
# ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head >> $output
top -b -d 1 -n 17280 | head >> $output
sleep 1
done
linux_长时间监控cpu负载脚本
于 2024-01-11 09:26:52 首次发布
本文介绍了一个用Bash编写的脚本,通过循环执行`date`和`top`命令,并过滤和排序,将结果写入./cpu.log,用于持续监控系统性能。
摘要由CSDN通过智能技术生成