Revision 2, 459 bytes
(checked in by yumileroy, 17 years ago)
|
[svn] * Proper SVN structure
Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | # Massive Network Game Object Server |
---|
3 | # Monitoring Script |
---|
4 | |
---|
5 | pid=`ps ax | awk '($5 ~ /mangos-worldd/) { print $1 }'` |
---|
6 | cpu=`top -b -n 1 -p $pid | awk '($12 ~ /mangos-worldd/) { print $9 }'` |
---|
7 | #echo $pid |
---|
8 | #echo $cpu |
---|
9 | intcpu=${cpu%.*} |
---|
10 | #echo $intcpu |
---|
11 | if [ "$intcpu" -gt "95" ] |
---|
12 | then |
---|
13 | kill -9 $pid |
---|
14 | echo "Killed MaNGOS for exceeding it's cpu limit." |
---|
15 | echo `date` ", Killed MaNGOS for $intcpu% CPU Usage." >> serverlog |
---|
16 | else |
---|
17 | echo "MaNGOS Passes the cpu test." |
---|
18 | fi |
---|