aboutsummaryrefslogtreecommitdiff
path: root/src/trinitycore/monitor-mangosd
diff options
context:
space:
mode:
Diffstat (limited to 'src/trinitycore/monitor-mangosd')
-rw-r--r--src/trinitycore/monitor-mangosd18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/trinitycore/monitor-mangosd b/src/trinitycore/monitor-mangosd
new file mode 100644
index 00000000000..a740ae5e8fa
--- /dev/null
+++ b/src/trinitycore/monitor-mangosd
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Massive Network Game Object Server
+# Monitoring Script
+
+pid=`ps ax | awk '($5 ~ /mangos-worldd/) { print $1 }'`
+cpu=`top -b -n 1 -p $pid | awk '($12 ~ /mangos-worldd/) { print $9 }'`
+#echo $pid
+#echo $cpu
+intcpu=${cpu%.*}
+#echo $intcpu
+if [ "$intcpu" -gt "95" ]
+then
+ kill -9 $pid
+ echo "Killed MaNGOS for exceeding it's cpu limit."
+ echo `date` ", Killed MaNGOS for $intcpu% CPU Usage." >> serverlog
+else
+ echo "MaNGOS Passes the cpu test."
+fi