Jump to content
  • 0

Multiple Server (1 login, 2 char, 2 map)


Bacanaman

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  05/28/17
  • Last Seen:  

I'm planning on opening another server and run it in the same host as my first one. So I found some guides on that, but I have 2 questions about it:

1- How will the VIP work, if I use the default vip system? I imagine that if a player becomes VIP on one server, he will be VIP in both, right? As the default VIP system uses the login table (group_id + vip_time) to know if the player is VIP or not.

2- How do I rename my char-server and map-server and how do I start only these two? It does not work if I just chnge the char and map-server file names and run './athena-start start'. Also running that command starts the login server too.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

1- it might an issue if you use vip system in both servers ( i might use custom vip system if i use two servers with one login table )

2- you can start using

 ./map-server 

./char-server

make sure to use diff ports 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  05/28/17
  • Last Seen:  

On 04/06/2017 at 0:03 PM, Cyro said:

1- it might an issue if you use vip system in both servers ( i might use custom vip system if i use two servers with one login table )

2- you can start using

 ./map-server 


./char-server

make sure to use diff ports 

I'll use diff ports, but how to change the server names? Will look further on using another vip system on the second server. Thanks!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  101
  • Reputation:   3
  • Joined:  09/15/16
  • Last Seen:  

Server names will be in map_athena.conf

 

and in clientinfo.xml

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  05/28/17
  • Last Seen:  

5 hours ago, iamkevin said:

Server names will be in map_athena.conf

 

and in clientinfo.xml

I mean the map-server and char-server - basically their process name

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  101
  • Reputation:   3
  • Joined:  09/15/16
  • Last Seen:  

no need you can try my 

./athena-start

#!/bin/sh

#source var/function
. ./function.sh
inst_launch_workaround

PATH=./:$PATH
LOG_DIR="./log"

print_start() {
	#    more << EOF
	echo "Athena Starting..."
	echo "            (c) 2013 rAthena Project"
	echo ""
	echo ""
	echo "checking..."
	#EOF
}

get_status(){
	PIDFILE=.$1.pid
	if [ -e ${PIDFILE} ]; then
		ISRUN=$(ps ax | grep $(cat ${PIDFILE}) | grep $1)
		PSRUN=$(echo "$ISRUN" | awk '{ print $1 }')
	fi
	#return ${PSRUN} #seem to cause issue for some os
}

#cheking if already started, launch and mark in log
start_serv(){ 
	get_status $1
	if [ $2 ]; then #is logging on ?
		LOGFILE="$LOG_DIR/$1.launch.log"
		LOGRUN="$LOG_DIR/$1.log"
		FIFO="$1_fifo"
		echo "stat_serv, log is enabled"
		echo "My logfile=${LOGFILE}"
		if [ -z ${PSRUN} ]; then
		if [ -e ./${FIFO} ]; then rm "$FIFO"; fi
			mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$1" > "$FIFO" 2>&1 & PID=$!
			#"./$1" > >(tee "$LOGRUN") 2>&1 & PID=$! #bash only
			echo "$PID" > .$1.pid
			echo "Server '$1' started at `date +"%m-%d-%H:%M-%S"`" | tee ${LOGFILE}
		else
			echo "Can't start '$1', cause is already running p${PSRUN}" | tee ${LOGFILE}
		fi
	else
		if [ -z ${PSRUN} ]; then
			./$1&
			echo "$!" > .$1.pid
			echo "Server '$1' started at `date +"%m-%d-%H:%M-%S"`"
		else
			echo "Can't start '$1', cause is already running p${PSRUN}"
		fi
	fi
}

watch_serv(){
	ulimit -Sc unlimited

	#now checking status and looping
	count=0;
	while true; do
		for i in ${C_SRV} ${M_SRV}
		do
			LOGFILE="$LOG_DIR/$i.launch.log"
			LOGRUN="$LOG_DIR/$i.log"
			FIFO=$i"_fifo"
	
			get_status $i
			#echo "Echo id of $i is ${PSRUN}"
			if [ -z ${PSRUN} ]; then
				count=$((count+1))
				#echo "fifo=$FIFO"
				echo "server '$i' is down"
				echo "server '$i' is down" >> ${LOGFILE}
				echo "restarting server at time at `date +"%m-%d-%H:%M-%S"`" 
				echo "restarting server at time at `date +"%m-%d-%H:%M-%S"`" >> ${LOGFILE}
				if [ -e $FIFO ]; then rm $FIFO; fi
				mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$i" > "$FIFO" 2>&1 & PID=$!
				echo "$PID" > .$i.pid
				if [ $2 ] && [ $2 -lt $count ]; then break; fi   
			fi
		done
		sleep $1
	done
}

restart(){
	$0 stop
	if [ $1 ]; then sleep $1; fi
	for i in ${C_SRV} ${M_SRV}
	do
		FIFO="$1_fifo"
		while true; do
			get_status ${i}
			if [ ${PSRUN} ]; then echo "'${i}' is still running p${PSRUN} waiting end"; sleep 2;
			else 
				if [ -e ./${FIFO} ]; then rm "$FIFO"; fi
				break
			fi
		done
	done
  $0 start
}

case $1 in
    'start')
		print_start
		check_files
		echo "Check complete."
		echo "Looks good, a nice Athena!"
		if [ "$2" = "--enlog" ]; then
		 ENLOG=1
		 if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi
		 echo "Logging is enable in $LOG_DIR"
		else
		 echo "Logging is disable"
		fi
		for i in ${C_SRV} ${M_SRV}
		do
			start_serv $i $ENLOG
		done
		echo "Now Started Athena."
	;;
    'watch')
		if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi
		if [ -z $2 ]; then Restart_count=10; else Restart_count=$2; fi
		if [ -z $3 ]; then Restart_sleep=3; else Restart_sleep=$3; fi
		echo " Gonna watch rA for Restart_count = $Restart_count, Restart_sleep= $Restart_sleep"
		for i in ${C_SRV} ${M_SRV}
		do
			start_serv $i 1
		done
		watch_serv $Restart_count $Restart_sleep
		echo "Now watching Athena."
	;;	
	'stop')
		for i in ${C_SRV} ${M_SRV}
		do
			PIDFILE=.${i}.pid
			if [ -e ./${PIDFILE} ]; then
				kill $(cat ${PIDFILE})
				rm ${PIDFILE}
			fi
		done
	;;
	'restart')
		 restart
	;;
	'status')
		for i in ${C_SRV} ${M_SRV}
		do
			get_status ${i}
			if [ ${PSRUN} ]; then echo "'${i}' is running p${PSRUN}"; else echo "'${i}' seem down"; fi
		done
	;;
	'val_runonce')
		for i in ${C_SRV} ${M_SRV}
		do
			valgrind --leak-check=full --show-leak-kinds=all ./$i --run-once > "log/$i.runonce.leak"
		done
	;;
	'valchk')
		for i in ${C_SRV} ${M_SRV}
		do
			valgrind --leak-check=full --show-leak-kinds=all ./$i > "log/$i.runonce.leak"
		done
	;;
	'help')
		case $2 in
			'start')
				echo "syntax: 'start {--enlog}'"
				echo "This option will starts the servs"
				echo "--enlog will tee all terminal output into a log/$servname.log file"
			;;
			'stop')
				echo "This option will shutdowns the servs'"
			;;
			'restart')
				echo "syntax: 'restart {<delay>}'"
				echo "This option will wait delay then will attempt to restart the servs"
				echo "NB, even if delay is over it will wait the pid is finished before atetmpting to restart servs"
			;;
			'status')
				echo "syntax: 'watch {<restart_intervall> <restart_count>}'"
				echo "This option let you know if the server are running or not"
				echo "NB this option is based on PID and supposed you have launch the serv by this script"
				echo " If it wasn't the case please use something like 'ps ax | grep server' to know their status"
			;;
			'watch')
				echo "syntax: 'watch {<restart_intervall> <restart_count>}'"
				echo "The watch option allow you to auto restart the server when this one was stopped"
				echo "<restart_intervall> delay in second before recheking if server are down (default 10) "
				echo "<restart_count> how many time should we restart servs (default 3), (-1=undefinitly)"
			;;
			'val_runonce')
				echo "syntax: 'val_runonce'"
				echo "This option will run valgrin with run-once to check the serv"
			;;
			'valchk')
				echo "syntax: 'valchk'"
				echo "This option will run valgrin with the serv"
			;;
			*)
				echo "Please specify a command you'll like more info  { start | stop | restart | status | watch }"
				read -p "Enter a valid command: " readEnterKey
				$0 "help" $readEnterKey
			;;
		esac
	;;
	*)
		echo "Usage: athena-start { start | stop | restart | status | watch | help | val_runonce | valchk }"
		read -p "Enter a valid option: " readEnterKey
		$0 $readEnterKey
	;;
esac

it will only run map-server and char-server.. leaving your login-server to your main server

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  208
  • Reputation:   22
  • Joined:  01/14/13
  • Last Seen:  

On 6/7/2017 at 3:11 AM, iamkevin said:

no need you can try my 

./athena-start


#!/bin/sh

#source var/function
. ./function.sh
inst_launch_workaround

PATH=./:$PATH
LOG_DIR="./log"

print_start() {
	#    more << EOF
	echo "Athena Starting..."
	echo "            (c) 2013 rAthena Project"
	echo ""
	echo ""
	echo "checking..."
	#EOF
}

get_status(){
	PIDFILE=.$1.pid
	if [ -e ${PIDFILE} ]; then
		ISRUN=$(ps ax | grep $(cat ${PIDFILE}) | grep $1)
		PSRUN=$(echo "$ISRUN" | awk '{ print $1 }')
	fi
	#return ${PSRUN} #seem to cause issue for some os
}

#cheking if already started, launch and mark in log
start_serv(){ 
	get_status $1
	if [ $2 ]; then #is logging on ?
		LOGFILE="$LOG_DIR/$1.launch.log"
		LOGRUN="$LOG_DIR/$1.log"
		FIFO="$1_fifo"
		echo "stat_serv, log is enabled"
		echo "My logfile=${LOGFILE}"
		if [ -z ${PSRUN} ]; then
		if [ -e ./${FIFO} ]; then rm "$FIFO"; fi
			mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$1" > "$FIFO" 2>&1 & PID=$!
			#"./$1" > >(tee "$LOGRUN") 2>&1 & PID=$! #bash only
			echo "$PID" > .$1.pid
			echo "Server '$1' started at `date +"%m-%d-%H:%M-%S"`" | tee ${LOGFILE}
		else
			echo "Can't start '$1', cause is already running p${PSRUN}" | tee ${LOGFILE}
		fi
	else
		if [ -z ${PSRUN} ]; then
			./$1&
			echo "$!" > .$1.pid
			echo "Server '$1' started at `date +"%m-%d-%H:%M-%S"`"
		else
			echo "Can't start '$1', cause is already running p${PSRUN}"
		fi
	fi
}

watch_serv(){
	ulimit -Sc unlimited

	#now checking status and looping
	count=0;
	while true; do
		for i in ${C_SRV} ${M_SRV}
		do
			LOGFILE="$LOG_DIR/$i.launch.log"
			LOGRUN="$LOG_DIR/$i.log"
			FIFO=$i"_fifo"
	
			get_status $i
			#echo "Echo id of $i is ${PSRUN}"
			if [ -z ${PSRUN} ]; then
				count=$((count+1))
				#echo "fifo=$FIFO"
				echo "server '$i' is down"
				echo "server '$i' is down" >> ${LOGFILE}
				echo "restarting server at time at `date +"%m-%d-%H:%M-%S"`" 
				echo "restarting server at time at `date +"%m-%d-%H:%M-%S"`" >> ${LOGFILE}
				if [ -e $FIFO ]; then rm $FIFO; fi
				mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$i" > "$FIFO" 2>&1 & PID=$!
				echo "$PID" > .$i.pid
				if [ $2 ] && [ $2 -lt $count ]; then break; fi   
			fi
		done
		sleep $1
	done
}

restart(){
	$0 stop
	if [ $1 ]; then sleep $1; fi
	for i in ${C_SRV} ${M_SRV}
	do
		FIFO="$1_fifo"
		while true; do
			get_status ${i}
			if [ ${PSRUN} ]; then echo "'${i}' is still running p${PSRUN} waiting end"; sleep 2;
			else 
				if [ -e ./${FIFO} ]; then rm "$FIFO"; fi
				break
			fi
		done
	done
  $0 start
}

case $1 in
    'start')
		print_start
		check_files
		echo "Check complete."
		echo "Looks good, a nice Athena!"
		if [ "$2" = "--enlog" ]; then
		 ENLOG=1
		 if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi
		 echo "Logging is enable in $LOG_DIR"
		else
		 echo "Logging is disable"
		fi
		for i in ${C_SRV} ${M_SRV}
		do
			start_serv $i $ENLOG
		done
		echo "Now Started Athena."
	;;
    'watch')
		if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi
		if [ -z $2 ]; then Restart_count=10; else Restart_count=$2; fi
		if [ -z $3 ]; then Restart_sleep=3; else Restart_sleep=$3; fi
		echo " Gonna watch rA for Restart_count = $Restart_count, Restart_sleep= $Restart_sleep"
		for i in ${C_SRV} ${M_SRV}
		do
			start_serv $i 1
		done
		watch_serv $Restart_count $Restart_sleep
		echo "Now watching Athena."
	;;	
	'stop')
		for i in ${C_SRV} ${M_SRV}
		do
			PIDFILE=.${i}.pid
			if [ -e ./${PIDFILE} ]; then
				kill $(cat ${PIDFILE})
				rm ${PIDFILE}
			fi
		done
	;;
	'restart')
		 restart
	;;
	'status')
		for i in ${C_SRV} ${M_SRV}
		do
			get_status ${i}
			if [ ${PSRUN} ]; then echo "'${i}' is running p${PSRUN}"; else echo "'${i}' seem down"; fi
		done
	;;
	'val_runonce')
		for i in ${C_SRV} ${M_SRV}
		do
			valgrind --leak-check=full --show-leak-kinds=all ./$i --run-once > "log/$i.runonce.leak"
		done
	;;
	'valchk')
		for i in ${C_SRV} ${M_SRV}
		do
			valgrind --leak-check=full --show-leak-kinds=all ./$i > "log/$i.runonce.leak"
		done
	;;
	'help')
		case $2 in
			'start')
				echo "syntax: 'start {--enlog}'"
				echo "This option will starts the servs"
				echo "--enlog will tee all terminal output into a log/$servname.log file"
			;;
			'stop')
				echo "This option will shutdowns the servs'"
			;;
			'restart')
				echo "syntax: 'restart {<delay>}'"
				echo "This option will wait delay then will attempt to restart the servs"
				echo "NB, even if delay is over it will wait the pid is finished before atetmpting to restart servs"
			;;
			'status')
				echo "syntax: 'watch {<restart_intervall> <restart_count>}'"
				echo "This option let you know if the server are running or not"
				echo "NB this option is based on PID and supposed you have launch the serv by this script"
				echo " If it wasn't the case please use something like 'ps ax | grep server' to know their status"
			;;
			'watch')
				echo "syntax: 'watch {<restart_intervall> <restart_count>}'"
				echo "The watch option allow you to auto restart the server when this one was stopped"
				echo "<restart_intervall> delay in second before recheking if server are down (default 10) "
				echo "<restart_count> how many time should we restart servs (default 3), (-1=undefinitly)"
			;;
			'val_runonce')
				echo "syntax: 'val_runonce'"
				echo "This option will run valgrin with run-once to check the serv"
			;;
			'valchk')
				echo "syntax: 'valchk'"
				echo "This option will run valgrin with the serv"
			;;
			*)
				echo "Please specify a command you'll like more info  { start | stop | restart | status | watch }"
				read -p "Enter a valid command: " readEnterKey
				$0 "help" $readEnterKey
			;;
		esac
	;;
	*)
		echo "Usage: athena-start { start | stop | restart | status | watch | help | val_runonce | valchk }"
		read -p "Enter a valid option: " readEnterKey
		$0 $readEnterKey
	;;
esac


it will only run map-server and char-server.. leaving your login-server to your main server

This fix some problem nice.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...