summaryrefslogtreecommitdiff
path: root/misc/src/tool/mapcheck.sh
diff options
context:
space:
mode:
Diffstat (limited to 'misc/src/tool/mapcheck.sh')
-rw-r--r--misc/src/tool/mapcheck.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/misc/src/tool/mapcheck.sh b/misc/src/tool/mapcheck.sh
new file mode 100644
index 0000000..337884c
--- /dev/null
+++ b/misc/src/tool/mapcheck.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+echo "============================================"
+echo "= map server status checker... ="
+echo "============================================"
+./map-server.exe &
+sleep 40
+
+while [ 0 ]
+do
+ pcpu=` top -n 1| grep map-server | awk '{print $9}' | awk 'BEGIN{FS="."} {print $1}' `
+ if [ "$pcpu" -gt 80 ];then
+ echo "============================================"
+ echo "map server is more than 80% (now $pcpu%)"
+ echo "============================================"
+ ppid=` ps -a | grep map-server | awk '{print $1}' `
+ kill $ppid
+ ./map-server.exe &
+ sleep 40
+ else
+ pmapct=` ps -a| grep map-server | wc -l `
+ if [ "$pmapct" -eq 0 ];then
+ echo "============================================"
+ echo "map server is not running..."
+ echo "restart map server..."
+ echo "============================================"
+ ./map-server.exe &
+ sleep 40
+ #echo "test"
+ else
+ echo "map server is ok (now $pcpu%)..."
+ sleep 5
+ fi
+ fi
+done \ No newline at end of file