linux 监控进程所消耗的资源(内存),达到阈值(绝对值、相对值)后,将其杀死
监控某个python进程是否存在,如不存在则启动
#!/bin/bash
while [ 1 ]
do
#打印出当前的jboss进程:grep jboss查询的jboss进程,grep -v "grep" 去掉grep进程
jmsThread=`ps -ef | grep DirectServer | grep -v "grep"`
# echo $jmsThread
#查询jboss进程个数:wc -l 返回行数
count=`ps -ef | grep DirectServer | grep -v "grep" | wc -l`
# echo $count
if [ $count -eq 0 ]; then
s="cd /root/tools/trunk/bin;nohup python DirectServer.py start"
eval $s
# echo "bad!"
# else
# echo "ok"
fi
done