用nc做简单web服务器监控机器状态
#!/bin/bash
top -b -n 1 >topinfo.txt
prog="nc -l 9944"
count=1;
echo "beging"
while [ count>0 ]
do
        pnum=`ps -wef|grep "${prog}" |grep -v grep |grep " 1 "|wc -l`
        echo $pnum
        if  test $pnum -lt 1
        then
                top -b -n 1 >topinfo.txt
                nc -l 9944         fi
done    

你可以用firfox浏览器查看了.如http://218.206.84.146:9944/
11-04 16:05
查看更多