用shell写的基本监控菜单
#!/bin/bashwhile :
do
echo "1. 查看CPU
[*]查看内存
[*]查看磁盘
[*]查看IP
[*]退出"
read -p "请选择菜单: " item
if [ ${item} -eq 1 ]; then
echo "CPU工作频率如下:"
cat /proc/cpuinfo | grep MH
read -p "输入回车继续"
fi
if [ ${item} -eq 2 ]; then
echo "可用内存如下:"
free | grep +
read -p "输入回车继续"
fi
if [ ${item} -eq 3 ]; then
echo "磁盘数据如下:"
df -h | grep boot
read -p "输入回车继续"
fi
if [ ${item} -eq 4 ]; then
echo "IP信息如下: "
ifconfig | grep "Bcast"
read -p "输入回车继续"
fi
if [ ${item} -eq 5 ]; then
exit 0
fi
done
页:
[1]