summaryrefslogtreecommitdiff
path: root/start
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-27 08:15:28 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-27 08:15:28 +0000
commit6441bc7fe9d6f9f70bba90258cf753ebf92dc7e5 (patch)
tree89b95e3236695469f22d96afcce0694a4f095b8d /start
parent5455fd1184e75c9192a1f6f84355851a01258e48 (diff)
downloadhercules-6441bc7fe9d6f9f70bba90258cf753ebf92dc7e5.tar.gz
hercules-6441bc7fe9d6f9f70bba90258cf753ebf92dc7e5.tar.bz2
hercules-6441bc7fe9d6f9f70bba90258cf753ebf92dc7e5.tar.xz
hercules-6441bc7fe9d6f9f70bba90258cf753ebf92dc7e5.zip
* Added jAthena's new start and athena-start shell scripts.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5765 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'start')
-rw-r--r--start109
1 files changed, 77 insertions, 32 deletions
diff --git a/start b/start
index 2a9dfd060..82cfb7a40 100644
--- a/start
+++ b/start
@@ -1,32 +1,77 @@
-#!/bin/bash
-
-./athena-start start
-sleep 30
-
-while [ true ] ; do
-if [ " 0" = "$(ps | grep -e login | wc -l)" ] ||
- [ " 0" = "$(ps | grep -e char | wc -l)" ] ||
- [ " 0" = "$(ps | grep -e map | wc -l)" ]; then
-printf "Error:"
-date
- sleep 10
- printf "Checking:"
- date
- if [ " 0" = "$(ps | grep -e login | wc -l)" ] ||
- [ " 0" = "$(ps | grep -e char | wc -l)" ] ||
- [ " 0" = "$(ps | grep -e map | wc -l)" ]; then
- printf "Error Confirmation:"
- date
- printf "Restoration:"
- date
- ./athena-start start
- else
- printf "Check Miss Sorry:"
- date
- fi
-#else
-#printf "Check OK:"
-#date
-fi
-sleep 10
-done \ No newline at end of file
+#!/bin/sh
+
+# Athena自動再起動スクリプト
+#
+# [USAGE] ./start
+#
+# 既にAthenaを起動した状態では実行しないで下さい。
+# サーバーの状態を確認するスクリプトが動作するので、シェルに戻りません。
+# Athenaを止めたいときは Ctrl+C で終了してください。
+# 
+# もしくは ./start & としてバックグラウンドで起動すると
+# シェルに戻ってきますが、サーバーの停止が少し面倒です。
+
+L_SRV=./bin/login-server
+C_SRV=./bin/char-server
+M_SRV=./bin/map-server
+
+process_check() {
+ # check login server
+ if [ ! -f ${L_SRV}.pid ]; then
+ login=0
+ else
+ login=`cat ${L_SRV}.pid`
+ login=$(ps ax | grep "${L_SRV}" | grep "${login}" | wc -l)
+ fi
+
+ # check char server
+ if [ ! -f ${C_SRV}.pid ]; then
+ char=0
+ else
+ char=`cat ${C_SRV}.pid`
+ char=$(ps ax | grep "${C_SRV}" | grep "${char}" | wc -l)
+ fi
+
+ # check map server
+ if [ ! -f ${M_SRV}.pid ]; then
+ map=0
+ else
+ map=`cat ${M_SRV}.pid`
+ map=$(ps ax | grep "${M_SRV}" | grep "${map}" | wc -l)
+ fi
+
+ # echo "check: ${login} ${char} ${map}"
+ echo `expr ${login} + ${char} + ${map}`
+}
+
+if [ `process_check` -ne 0 ]; then
+ echo "Athena is already running..."
+else
+ ./athena-start start
+ sleep 30
+
+ while true
+ do
+ if [ `process_check` -lt 3 ]; then
+ printf "Error:"
+ date
+ sleep 10
+ printf "Checking:"
+ date
+ if [ `process_check` -lt 3 ]; then
+ printf "Error Confirmation:"
+ date
+ printf "Restoration:"
+ date
+ ./athena-start restart
+ else
+ printf "Check Miss Sorry:"
+ date
+ fi
+ #else
+ # printf "Check OK:"
+ # date
+ fi
+ sleep 10
+ done
+fi