#!/bin/bash
while [ true ]; do
/bin/sleep 3
ps auxw|awk '{if (NR>1){print $3}}' > /opt/cpu_list
awk '{CPU_PER+=$1}END{print CPU_PER}'  /opt/cpu_list | awk '{ print $0"\t" strftime("%H:%M:%S",systime()) } ' >> cpu.txt
done

Logo

更多推荐