Updated Unix start scripts from Shazeya, please read changelog for details

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11070 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
DracoRPG 2007-08-23 22:05:28 +00:00
parent c683940c0d
commit 021481ab09
3 changed files with 88 additions and 328 deletions

View File

@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/08/23
* Updated athena-start & start to Shazeya's hack. Please test them! [DracoRPG]
- Simplest way is to run ./start that is equivalent to Windows runserver_sql.bat
- To run TXT instead, edit the beginning of athena-start with proper filenames
2007/08/22 2007/08/22
* Fixed Dragon Fear's status change selection and duration. * Fixed Dragon Fear's status change selection and duration.
* Fixed Metamorphosis not displaying a speed-change update on the client. * Fixed Metamorphosis not displaying a speed-change update on the client.

View File

@ -1,276 +1,74 @@
#!/bin/sh #!/bin/sh
# athena starting script by rowla # athena starting script by rowla
# modified by shazeya@syafi.com (NL101541)
# chkconfig: 345 99 01
# description: start and stop athena service
PATH=./:$PATH PATH=./:$PATH
L_SRV=./bin/login-server L_SRV=login-server_sql
C_SRV=./bin/char-server C_SRV=char-server_sql
M_SRV=./bin/map-server M_SRV=map-server_sql
L_SRV_C=./conf/login_athena.conf
C_SRV_C=./conf/char_athena.conf
C_SRV_C2=./conf/inter_athena.conf
M_SRV_C=./conf/map_athena.conf
M_SRV_C2=./conf/battle_athena.conf
M_SRV_C3=./conf/atcommand_athena.conf
M_SRV_C4=./conf/script_athena.conf
M_SRV_C5=./conf/msg_athena.conf
print_start() { print_start() {
# more << EOF # more << EOF
echo "Athena Starting..." echo "Athena Starting..."
echo " (c) 2003 Athena Project." echo " (c) 2003 Athena Project"
echo " URL:http://project-yare.de/" echo " modified by shazeya@syafi.com"
echo ""
echo "Debug informations will appear,"
echo "since this is a test release."
echo "" echo ""
#echo "Debug informations will appear,"
#echo "since this is a test release."
#echo ""
echo "checking..." echo "checking..."
#EOF #EOF
} }
check_account() { #check_account() {
if [ ! -d ./save ]; then # if [ ! -f ./save/account.txt ]; then
mkdir ./save # echo "0 s1 p1 - S 0" > save/account.txt
fi # echo "1 s2 p2 - S 0" >>save/account.txt
# echo "2 s3 p3 - S 0" >>save/account.txt
if [ ! -d ./log ]; then # echo "3 s4 p4 - S 0" >>save/account.txt
mkdir ./log # echo "4 s5 p5 - S 0" >>save/account.txt
fi # fi
#}
if [ ! -d ./conf/import ]; then
mkdir ./conf/import
fi
if [ ! -f ./save/account.txt ]; then
i=0
while [ $i -le 4 ];
do
echo -e "$i\ts`expr $i + 1`\tp`expr $i + 1`\t-\tS\t0\t0\r" >> save/account.txt
i=`expr $i + 1`
done
fi
if [ ! -f ./save/athena.txt ]; then
echo -n > save/athena.txt
fi
if [ ! -f ./save/bank.txt ]; then
echo -n > save/bank.txt
fi
if [ ! -f ./save/guild.txt ]; then
echo -n > save/guild.txt
fi
if [ ! -f ./save/party.txt ]; then
echo -n > save/party.txt
fi
if [ ! -f ./save/pet.txt ]; then
echo -n > save/pet.txt
fi
if [ ! -f ./save/storage.txt ]; then
echo -n > save/storage.txt
fi
if [ ! -f ./save/castle.txt ]; then
i=0
while [ $i -le 19 ];
do
echo -e "$i,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0\r" >> save/castle.txt
i=`expr $i + 1`
done
fi
if [ ! -f ./conf/import/atcommand_conf.txt ]; then
echo -n > conf/import/atcommand_conf.txt
fi
if [ ! -f ./conf/import/battle_conf.txt ]; then
echo -n > conf/import/battle_conf.txt
fi
if [ ! -f ./conf/import/char_conf.txt ]; then
echo -n > conf/import/char_conf.txt
fi
if [ ! -f ./conf/import/inter_conf.txt ]; then
echo -n > conf/import/inter_conf.txt
fi
if [ ! -f ./conf/import/login_conf.txt ]; then
echo -n > conf/import/login_conf.txt
fi
if [ ! -f ./conf/import/map_conf.txt ]; then
echo -n > conf/import/map_conf.txt
fi
}
check_files() { check_files() {
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${L_SRV_C} ${C_SRV_C} ${C_SRV_C2} ${M_SRV_C} ${M_SRV_C2} ${M_SRV_C3} ${M_SRV_C4} ${M_SRV_C5} for i in ${L_SRV} ${C_SRV} ${M_SRV}
do do
if [ ! -f ./$i ]; then if [ ! -f ./$i ]; then
echo "$i does not exist, or can't run." echo "$i does not exist, or can't run."
echo "Stoped, Check your compile or configuration file." echo "Stop. Check your compile."
exit 1; exit 1;
fi fi
done done
# more << EOF # more << EOF
echo "Check done." echo "Check complete."
echo "Looks good, have a nice athena!" echo "Looks good, a nice Athena!"
#EOF #EOF
} }
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}`
}
case $1 in case $1 in
'start') 'start')
if [ `process_check` -eq 0 ]; then print_start
print_start # check_account
check_account check_files
check_files
exec ${L_SRV} ${L_SRV_C}& exec ./${L_SRV}&
# exec ${C_SRV} ${C_SRV_C} ${C_SRV_C2} > /dev/null& exec ./${C_SRV}&
# exec ${M_SRV} ${M_SRV_C} ${M_SRV_C2} > /dev/null& exec ./${M_SRV}&
exec ${C_SRV} ${C_SRV_C} ${C_SRV_C2}&
# exec nice -n -20 ${M_SRV} ${M_SRV_C} ${M_SRV_C2} ${M_SRV_C3} ${M_SRV_C4} ${M_SRV_C5}&
exec ${M_SRV} ${M_SRV_C} ${M_SRV_C2} ${M_SRV_C3} ${M_SRV_C4} ${M_SRV_C5}&
echo "Now Started Athena." echo "Now Started Athena."
else ;;
echo "Athena is already running..." 'stop')
fi ps ax | grep -E "${L_SRV}|${C_SRV}|${M_SRV}" | awk '{print $1}' | xargs kill -9
;;
'restart')
$0 stop
$0 start
;;
*)
echo "Usage: athena-start { start | stop | restart }"
;; ;;
'stop')
# check map server
if [ -f ${M_SRV}.pid ]; then
map=`cat ${M_SRV}.pid`
map=$(ps ax | grep "${M_SRV}" | grep "${map}" | wc -l)
if [ ${map} -ne 0 ]; then
kill `cat ${M_SRV}.pid`
fi
fi
# check char server
if [ -f ${C_SRV}.pid ]; then
char=`cat ${C_SRV}.pid`
char=$(ps ax | grep "${C_SRV}" | grep "${char}" | wc -l)
if [ ${char} -ne 0 ]; then
kill `cat ${C_SRV}.pid`
fi
fi
# check login server
if [ -f ${L_SRV}.pid ]; then
login=`cat ${L_SRV}.pid`
login=$(ps ax | grep "${L_SRV}" | grep "${login}" | wc -l)
if [ ${login} -ne 0 ]; then
kill `cat ${L_SRV}.pid`
fi
fi
;;
'kill')
# check map server
if [ -f ${M_SRV}.pid ]; then
map=`cat ${M_SRV}.pid`
map=$(ps ax | grep "${M_SRV}" | grep "${map}" | wc -l)
if [ ${map} -ne 0 ]; then
kill -9 `cat ${M_SRV}.pid`
fi
fi
# check char server
if [ -f ${C_SRV}.pid ]; then
char=`cat ${C_SRV}.pid`
char=$(ps ax | grep "${C_SRV}" | grep "${char}" | wc -l)
if [ ${char} -ne 0 ]; then
kill -9 `cat ${C_SRV}.pid`
fi
fi
# check login server
if [ -f ${L_SRV}.pid ]; then
login=`cat ${L_SRV}.pid`
login=$(ps ax | grep "${L_SRV}" | grep "${login}" | wc -l)
if [ ${login} -ne 0 ]; then
kill -9 `cat ${L_SRV}.pid`
fi
fi
;;
'restart')
if [ `process_check` -eq 0 ]; then
$0 start
else
# 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
if [ ${login} -eq 0 ]; then
exec ${L_SRV} ${L_SRV_C}&
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
if [ ${char} -eq 0 ]; then
exec ${C_SRV} ${C_SRV_C} ${C_SRV_C2}&
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
if [ ${map} -eq 0 ]; then
exec ${M_SRV} ${M_SRV_C} ${M_SRV_C2} ${M_SRV_C3} ${M_SRV_C4} ${M_SRV_C5}&
fi
fi
;;
*)
echo "Usage: athena-start { start | stop | kill | restart }"
;;
esac esac

108
start
View File

@ -1,77 +1,35 @@
#!/bin/sh #!/bin/bash
# modified by shazeya@syafi.com (NL130240)
# Athena自動再起動スクリプト ./athena-start start
# sleep 30
# [USAGE] ./start
#
# 既にAthenaを起動した状態では実行しないで下さい。
# サーバーの状態を確認するスクリプトが動作するので、シェルに戻りません。
# Athenaを止めたいときは Ctrl+C で終了してください。
# 
# もしくは ./start & としてバックグラウンドで起動すると
# シェルに戻ってきますが、サーバーの停止が少し面倒です。
L_SRV=./bin/login-server while [ true ]; do
C_SRV=./bin/char-server if [ " 0" = "$(ps | grep -e log | wc -l)" ] ||
M_SRV=./bin/map-server # if [ " 0" = "$(ps | grep -e login | wc -l)" ] ||
[ " 0" = "$(ps | grep -e char | wc -l)" ] ||
process_check() { [ " 0" = "$(ps | grep -e map | wc -l)" ]; then
# check login server printf "Error:"
if [ ! -f ${L_SRV}.pid ]; then date
login=0 sleep 10
else printf "Checking:"
login=`cat ${L_SRV}.pid` date
login=$(ps ax | grep "${L_SRV}" | grep "${login}" | wc -l) if [ " 0" = "$(ps | grep -e log | wc -l)" ] ||
fi # if [ " 0" = "$(ps | grep -e login | wc -l)" ] ||
[ " 0" = "$(ps | grep -e char | wc -l)" ] ||
# check char server [ " 0" = "$(ps | grep -e map | wc -l)" ]; then
if [ ! -f ${C_SRV}.pid ]; then printf "Error Confirmation:"
char=0 date
else printf "Restoration:"
char=`cat ${C_SRV}.pid` date
char=$(ps ax | grep "${C_SRV}" | grep "${char}" | wc -l) ./athena-start start
fi else
printf "Check Miss Sorry:"
# check map server date
if [ ! -f ${M_SRV}.pid ]; then fi
map=0 # else
else # printf "Check OK:"
map=`cat ${M_SRV}.pid` # date
map=$(ps ax | grep "${M_SRV}" | grep "${map}" | wc -l) fi
fi sleep 10
done
# 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