Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Linux Servers

Support::Linux Servers Support forum for Linux EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-01-2013, 03:58 AM
HnathBST
Sarnak
 
Join Date: Feb 2007
Location: Sunset Home
Posts: 71
Default Linux Start/Stop script

I have been using the same start script for a while now and I finally decided to modify it and make it my own.

File: EQServer.sh
Code:
ulimit -c unlimited
case "$1" in
	start)
		export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.

		rm -rf logs/*.log
		chmod --recursive ugo+rwx quests

		#sleep 5
		echo Loading Shared Mem...
		./shared_memory > /dev/null 2>&1 &

		sleep 2
		echo Starting World Server...
		./world > /dev/null 2>&1 &
		echo $! > world.pid

		sleep 3
		echo Starting Query Server...
		./queryserv > /dev/null 2>&1 &
		echo $! > queryserv.pid

		sleep 5
		echo Starting the Zone Launcher...
		./eqlaunch zone > /dev/null 2>&1 &
		echo $! > eqlaunch.pid

		sleep 5
		echo The server is mostly ready... Give it a couple of minutes
		echo to load stuff from the database before the users start  logging in.
		;;
	stop)
		kill `cat world.pid`
		kill `cat queryserv.pid`
		kill `cat eqlaunch.pid`
		rm -f *.pid
		echo All server components have been exited.
		;;
	restart|reload)
		$0 stop
		$0 start
		;;
	status)
		if [ -f world.pid ] && ps -p `cat world.pid` > /dev/null
		then
			echo -e World Server '\t\t'  [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
		else
			echo -e World Server '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
		fi
		if [ -f queryserv.pid ] && ps -p `cat queryserv.pid` > /dev/null
                then
                        echo -e Query Server '\t\t' [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
                else
                        echo -e Query Server '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
                fi
		if [ -f eqlaunch.pid ] && ps -p `cat eqlaunch.pid` > /dev/null
                then
                        echo -e Zone Launcher '\t\t' [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
                else
                        echo -e Zone Launcher '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
                fi
		;;
	help|*)
		printf "Usage: \n ./EQServer.sh [start|stop|reload|restart|status|help]"
		printf "\n\n"
		printf " start\t\tStarts the server components\n"
		printf " stop\t\tStops all the server components started by this script\n"
		printf " restart/reload\tRestarts the server\n"
		printf " status\t\tLists the status of the server components\n"
		printf " help\t\tDisplays this message\n"
		;;

	esac
exit 0
Drop this in your server folder (with zone and world...) and execute it by running: ./EQServer.sh

Usage:
Code:
./EQServer.sh [start|stop|reload|restart|status|help]

 start		        Starts the server components
 stop		        Stops all the server components started by this script
 restart/reload	        Restarts the server
 status 		Lists the status of the server components
 help		        Displays this message
I know this works on Fedora (and likely centos/redhat etc) I haven't used it on any other flavor of linux so your results may vary.

--Webbe
Reply With Quote
  #2  
Old 11-01-2013, 12:16 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Yeah, that old startup script has been around forever, I don't even know who wrote it originally. Good work modernizing it some, I especially like the status addition.
Reply With Quote
  #3  
Old 11-01-2013, 03:08 PM
HnathBST
Sarnak
 
Join Date: Feb 2007
Location: Sunset Home
Posts: 71
Default

Yeah, I got tire of doing ps to try and figure out what isn't running lol. I'd eventually like to add other status like #of zones etc. in time.
Reply With Quote
  #4  
Old 12-16-2013, 05:54 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,165
Default

https://gist.github.com/mackal/7994207

Made some changes to it. Including using pgrep to count how many zones are up :P (note, you might have to use the commented one on CentOS etc since they use a different version of pgrep)
Reply With Quote
  #5  
Old 12-28-2014, 01:26 PM
DreamDemon
Fire Beetle
 
Join Date: Jan 2010
Location: Ohio
Posts: 2
Default

I updated it to include loginserver and ucs. This was tested on Ubuntu.

Code:
ulimit -c unlimited
case "$1" in
	start)
		export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.

		rm -rf logs/*.log
		chmod --recursive ugo+rwx quests

		#sleep 5
		echo Loading Shared Mem...
		./shared_memory > /dev/null 2>&1 &
		
		echo Starting Login Server...
		./loginserver > /dev/null 2>&1 &
		echo $! > loginserver.pid

		sleep 2
		echo Starting World Server...
		./world > /dev/null 2>&1 &
		echo $! > world.pid

		sleep 3
		echo Starting Query Server...
		./queryserv > /dev/null 2>&1 &
		echo $! > queryserv.pid
		
		echo Starting UCS Server...
		./ucs > /dev/null 2>&1 &
		echo $! > ucs.pid

		sleep 5
		echo Starting the PEQ Zone Launcher...
		./eqlaunch peq > /dev/null 2>&1 &
		echo $! > eqlaunch.pid

		sleep 5
		echo The server is mostly ready... Give it a couple of minutes
		echo to load stuff from the database before the users start  logging in.
		;;
	stop)
		kill `cat loginserver.pid`
		kill `cat world.pid`
		kill `cat queryserv.pid`
		kill `cat ucs.pid`
		kill `cat eqlaunch.pid`
		rm -f *.pid
		echo All server components have been exited.
		;;
	restart|reload)
		$0 stop
		$0 start
		;;
	status)
		if [ -f loginserver.pid ] && ps -p `cat loginserver.pid` > /dev/null
                then
                        echo -e Login Server '\t\t' [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
                else
                        echo -e Login Server '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
                fi
		if [ -f world.pid ] && ps -p `cat world.pid` > /dev/null
		then
			echo -e World Server '\t\t'  [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
		else
			echo -e World Server '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
		fi
		if [ -f queryserv.pid ] && ps -p `cat queryserv.pid` > /dev/null
                then
                        echo -e Query Server '\t\t' [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
                else
                        echo -e Query Server '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
                fi
		if [ -f ucs.pid ] && ps -p `cat ucs.pid` > /dev/null
                then
                        echo -e UCS Server '\t\t' [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
                else
                        echo -e UCS Server '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
                fi
		if [ -f eqlaunch.pid ] && ps -p `cat eqlaunch.pid` > /dev/null
                then
                        echo -e Zone Launcher '\t\t' [$(tput bold)$(tput setaf 2)UP$(tput sgr0)]
                else
                        echo -e Zone Launcher '\t\t' [$(tput bold)$(tput setaf 1)DOWN$(tput sgr0)]
                fi
		;;
	help|*)
		printf "Usage: \n ./EQServer.sh [start|stop|reload|restart|status|help]"
		printf "\n\n"
		printf " start\t\tStarts the server components\n"
		printf " stop\t\tStops all the server components started by this script\n"
		printf " restart/reload\tRestarts the server\n"
		printf " status\t\tLists the status of the server components\n"
		printf " help\t\tDisplays this message\n"
		;;

	esac
exit 0
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:31 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3