#!/bin/bash
while true:
do
echo "CPU占用为"
ps -aux | grep httpd | grep 'apache' | awk '{print $3}' | awk '{sum += $1};END {print sum}'
echo "内存为"
ps -aux | grep httpd | grep 'apache' | awk '{print $4}' | awk '{sum += $1};END {print sum}'
sleep 5s
done