Updated on 5月 14, 2019
Mono占用CPU100%
最近发现这个Mono + ASP.NET的环境似乎有点毛病
Mono占用CPU特别高
Google了一圈还是不知道为什么
于是从网上抄了别人写的一个脚本,每隔1分钟检测一次Mono的CPU占用,如果CPU占用过高就重启Mono
#!/bin/sh # monitor mono cpu usage record=0 while true; do cpu=$(top -b -n1 grep "mono" head -1 awk \'{print $9}\') pid=$(top -b -n1 grep "mono" head -1 awk \'{print $1}\') #cpu check result=${cpu/.*} if [[ $record == $pid ]];then kill -9 $pid;echo "$pid was killed";./startXingKongBeta.sh;fi if [[ $result > 95 $result == 100 ]];then let record=${pid};else let record=0;fi #echo echo `date +%F" "%H:%M:%S`+" cpu:$result% record pid:$record pid:$pid" sleep 60 done