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

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-09-2010, 08:35 PM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default Script to help setup server on Linux

The following script sets up the directories for building and running your server. It also creates scripts to get files from the subversion servers.
It is based on the Debian guide in the wiki, but could be used on any system that has bash.

Hope this helps...

Code:
#!/bin/bash

#Set this variable to where you want eqemu to go
EMUDIR=eqemuserver

if [ -e $EMUDIR ]; then 
   echo
   echo $EMUDIR already exists - exiting to avoid potential confusion
   echo  you might want to edit this script and set the EMUDIR to somewhere else
   exit
fi

if [ $EUID -eq 0 ]; then
   echo
   echo  you are running this script as root, possibly via su or sudo
   echo  EqEmu does not need superuser to install or run, except possibly
   echo  when you are setting up the database
   echo 
   echo  Either install this script as yourself, or create a dedicated
   echo  account to install and run EqEmu.
   echo  #!/bin/bash

#Set this variable to where you want eqemu to go
EMUDIR=eqemuserver

if [ -e $EMUDIR ]; then 
   echo
   echo $EMUDIR already exists - exiting to avoid potential confusion
   echo  you might want to edit this script and set the EMUDIR to somewhere else
   exit
fi

if [ $EUID -eq 0 ]; then
   echo
   echo  you are running this script as root, possibly via su or sudo
   echo  EqEmu does not need superuser to install or run, except possibly
   echo  when you are setting up the database
   echo 
   echo  Either install this script as yourself, or create a dedicated
   echo  account to install and run EqEmu.
   echo  
   echo  Exiting
   exit
fi

mkdir $EMUDIR
cd $EMUDIR

cat > getEqemu << EOD1
#!/bin/bash
svn checkout  http://projecteqemu.googlecode.com/svn/trunk/ projecteqemu-read-only
EOD1

cat > getEQmaps << EOD2
#!/bin/bash
svn checkout http://eqemumaps.googlecode.com/svn/trunk/ eqemumaps-read-only
EOD2

cat > getPEQdb << EOD3
#!/bin/bash
svn checkout http://projecteqdb.googlecode.com/svn/trunk/ projecteqdb-current-only
EOD3

cat > getQuest << EOD4
#!/bin/bash
svn checkout http://projecteqquests.googlecode.com/svn/trunk/ projecteqquests-read-only
EOD4

mkdir server

for s in getEQmaps getPEQdb getQuest getEqemu ; do chmod +x $s ; done

cd server

ln -s ../projecteqemu-read-only/EQEmuServer/ source

targets="source/chatserver/chatserver source/utils/cleanipc source/utils/defaults/eqemu_config.xml.full source/eqlaunch/eqlaunch source/EMuShareMem/libEMuShareMem.so source/utils/defaults/log.ini source/utils/mail_opcodes.conf source/mailserver/mailserver ../eqemumaps-read-only/Maps source/utils/defaults/mime.types source/utils/opcodes.conf source/utils/patch_6.2.conf source/utils/patch_Anniversary.conf source/utils/patch_Live.conf source/utils/patch_SoF.conf source/utils/patch_Titanium.conf source/utils/defaults/plugin.pl ../projecteqquests-read-only/quests/plugins ../projecteqquests-read-only/quests source/utils/defaults/templates source/world/world  source/utils/defaults/worldui  source/utils/defaults/worldui.pl  source/zone/zone"

for foo in $targets ; do
    ln -s $foo `basename $foo `
done

echo
echo the start and stop scripts are setup for the Privatelogin server
echo you will want to edit these scripts if you use minilogin or the official
echo login servers
echo

cat > start << EOD5
#!/bin/sh

#ulimit -c 99999999

rm -f .zone_shutdown
rm -f .world_shutdown

set -x

LNAME="zone"     #launcher name
if [ "$1" = "test" ]; then
        LNAME="test"
fi

# The following are for my setup of the PrivateLogin server
# Those who use minilogin or the new private login server will need 
# to modify this to suit -- Kobaz

#cd ../LS
#wine PrivateLogin.exe > logs/PrivateLogin.log &
#cd ../server

P=`pwd`
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$P"

#make sure we have a place to log
mkdir -p logs 2>&1 > /dev/null

#clear out old logs, if both are stopped
if [ ! -e .lock-zones -a ! -e .lock-world ] ; then
  for f in logs/eqemu_*.log
  do
        if [ "$f" = "logs/eqemu_commands_zone.log" ]; then
                continue;
        fi

        rm -f $f
  done
fi

#boot up world
if [ ! -e .lock-world ] ; then
        touch .lock-world
#       ./world 2>&1 > logs/world &
        ./persist_world 2>&1 > logs/world &
        # wait for shared memory to load
        sleep 15
fi

#start up the official launcher
if [ ! -e .lock-launcher ]; then
        touch .lock-launcher
        ./eqlaunch $LNAME 2>&1 > logs/launcher &
fi

./mailserver &
./chatserver &

EOD5

cat > stop << EOD6
#!/bin/sh

touch .zone_shutdown
touch .world_shutdown

#Users of the official private login server or minilogin
#will need to do something different here -- Kobaz
killall wine PrivateLogin.exe world eqlaunch zone mailserver chatserver
killall -9 PrivateLogin.exe
sleep 3

if ps ax|grep -e 'w[o]rld' -e 'z[o]ne' -e 'eq[l]aunch' -e 'mails[e]rver' -e  'cha[t]server' >/dev/null; then
                killall -9 world eqlaunch zone mailserver chatserver
                sleep 2
fi

./cleanipc
rm -f .lock-zones .lock-world .lock-login .lock-launcher
EOD6

cat > persist_world << EOD7
#!/bin/sh

#ulimit -c 99999999

while true
do
        ./world "$@"
        if [ -r ".world_shutdown" ]; then
                exit 0
        fi

        echo `date` "World crashed." >>crashlog
        sleep 2
done
EOD7

for a in persist_world start stop ; do chmod +x $a ; done

mkdir logs

cat << EOD | more

  Things you still have to do:

  -  create/edit your eqemu_config.xml 

  -  copy your spells_en.txt and spells_us.txt to the server folder

  -  Run the 4 "get" scripts in the eqemu directory. 
     This can take a long time, especially the maps...

  -  Build the server

  -  Source the database

  -  edit the start and stop scripts to reflect which login server you use

  Once all thats done, change to the ${EMUDIR}/server and run
  
      start

  to start the server and 

      stop
  
  to stop it.  Check your logfiles in ${EMUDIR}/server/logs.
EOD

   echo  Exiting
   exit
fi

mkdir $EMUDIR
cd $EMUDIR

cat > getEqemu << EOD1
#!/bin/bash
svn checkout  http://projecteqemu.googlecode.com/svn/trunk/ projecteqemu-read-only
EOD1

cat > getEQmaps << EOD2
#!/bin/bash
svn checkout http://eqemumaps.googlecode.com/svn/trunk/ eqemumaps-read-only
EOD2

cat > getPEQdb << EOD3
#!/bin/bash
svn checkout http://projecteqdb.googlecode.com/svn/trunk/ projecteqdb-current-only
EOD3

cat > getQuest << EOD4
#!/bin/bash
svn checkout http://projecteqquests.googlecode.com/svn/trunk/ projecteqquests-read-only
EOD4

mkdir server

for s in getEQmaps getPEQdb getQuest getEqemu ; do chmod +x $s ; done

cd server

ln -s ../projecteqemu-read-only/EQEmuServer/ source

targets="source/chatserver/chatserver source/utils/cleanipc source/utils/defaults/eqemu_config.xml.full source/eqlaunch/eqlaunch  \ 
source/EMuShareMem/libEMuShareMem.so source/utils/defaults/log.ini source/utils/mail_opcodes.conf source/mailserver/mailserver \ 
../eqemumaps-read-only/Maps source/utils/defaults/mime.types source/utils/opcodes.conf source/utils/patch_6.2.conf source/utils \
/patch_Anniversary.conf source/utils/patch_Live.conf source/utils/patch_SoF.conf source/utils/patch_Titanium.conf \
source/utils/defaults/plugin.pl ../projecteqquests-read-only/quests/plugins ../projecteqquests-read-only/quests \
source/utils/defaults/templates source/world/world  source/utils/defaults/worldui  source/utils/defaults/worldui.pl  source/zone/zone"

for foo in $targets ; do
    ln -s $foo `basename $foo `
done

echo
echo the start and stop scripts are setup for the Privatelogin server
echo you will want to edit these scripts if you use minilogin or the official
echo login servers
echo

cat > start << EOD5
#!/bin/sh

#ulimit -c 99999999

rm -f .zone_shutdown
rm -f .world_shutdown

set -x

LNAME="zone"     #launcher name
if [ "$1" = "test" ]; then
        LNAME="test"
fi

# The following are for my setup of the PrivateLogin server
# Those who use minilogin or the new private login server will need 
# to modify this to suit -- Kobaz

#cd ../LS
#wine PrivateLogin.exe > logs/PrivateLogin.log &
#cd ../server

P=`pwd`
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$P"

#make sure we have a place to log
mkdir -p logs 2>&1 > /dev/null

#clear out old logs, if both are stopped
if [ ! -e .lock-zones -a ! -e .lock-world ] ; then
  for f in logs/eqemu_*.log
  do
        if [ "$f" = "logs/eqemu_commands_zone.log" ]; then
                continue;
        fi

        rm -f $f
  done
fi

#boot up world
if [ ! -e .lock-world ] ; then
        touch .lock-world
#       ./world 2>&1 > logs/world &
        ./persist_world 2>&1 > logs/world &
        # wait for shared memory to load
        sleep 15
fi

#start up the official launcher
if [ ! -e .lock-launcher ]; then
        touch .lock-launcher
        ./eqlaunch $LNAME 2>&1 > logs/launcher &
fi

./mailserver &
./chatserver &

EOD5

cat > stop << EOD6
#!/bin/sh

touch .zone_shutdown
touch .world_shutdown

#Users of the official private login server or minilogin
#will need to do something different here -- Kobaz
killall wine PrivateLogin.exe world eqlaunch zone mailserver chatserver
killall -9 PrivateLogin.exe
sleep 3

if ps ax|grep -e 'w[o]rld' -e 'z[o]ne' -e 'eq[l]aunch' -e 'mails[e]rver' -e  'cha[t]server' >/dev/null; then
                killall -9 world eqlaunch zone mailserver chatserver
                sleep 2
fi

./cleanipc
rm -f .lock-zones .lock-world .lock-login .lock-launcher
EOD6

cat > persist_world << EOD7
#!/bin/sh

#ulimit -c 99999999

while true
do
        ./world "$@"
        if [ -r ".world_shutdown" ]; then
                exit 0
        fi

        echo `date` "World crashed." >>crashlog
        sleep 2
done
EOD7

for a in persist_world start stop ; do chmod +x $a ; done

mkdir logs

cat << EOD | more

  Things you still have to do:

  -  create/edit your eqemu_config.xml 

  -  copy your spells_en.txt and spells_us.txt to the server folder

  -  Run the 4 "get" scripts in the eqemu directory. 
     This can take a long time, especially the maps...

  -  Build the server

  -  Source the database

  -  edit the start and stop scripts to reflect which login server you use

  Once all thats done, change to the ${EMUDIR}/server and run
  
      start

  to start the server and 

      stop
  
  to stop it.  Check your logfiles in ${EMUDIR}/server/logs.
EOD

Last edited by Kobaz; 03-09-2010 at 08:40 PM.. Reason: line too long
Reply With Quote
 


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 10:19 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3