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 08-29-2010, 09:44 AM
amraist
Fire Beetle
 
Join Date: Aug 2005
Posts: 29
Default

Here is my startup script. It will start world, ucs, eqlogin(login server) and will use eqlauncher to start up zones. So you will need to have one setup in the database. If you notice any bugs, please let me know.

Code:
#!/bin/sh

# PROVIDE: eqemu
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name="eqemu"
start_cmd="${name}_start $2"
stop_cmd="${name}_stop $2"
restart_cmd="${name}_restart $2"
status_cmd="${name}_status $2"
extra_commands="status cleanipc"
determine_procs_cmd="eqemu_determine_procs"
cleanipc_cmd="${name}_cleanipc"
eqemu_enable=${eqemu_enable:-"YES"}
eqemu_home=${eqemu_home:-"/usr/local/eqemu"}
eqemu_user=${eqemu_user:-"eqemu"}
eqemu_group=${eqemu_group:-"eqemu"}
eqemu_world=${eqemu_world:-"NO"}
eqemu_eqlaunch=${eqemu_eqlaunch:-"NO"}
eqemu_eqlaunch_args=${eqemu_eqlaunch_args:-"zone"}
eqemu_ucs=${eqemu_ucs:-"NO"}
eqemu_eqlogin=${eqemu_eqlogin:-"NO"}
eqemu_world_args=${eqemu_world_args:-""}
eqemu_eqlogin_args=${eqemu_eqlogin_args:-""}
eqemu_ucs_args=${eqemu_ucs_args:-""}
rcvar=`set_rcvar`
load_rc_config $name

eqemu_determine_procs()
{
        unset "eqemu_procs"
        if  [ "${_rc_prefix}" = "one" ]  ; then
                case "$1" in
                        eqlogin)
                                eqemu_procs=$1
                                ;;
                        world)
                                eqemu_procs=$1
                                ;;
                        eqlaunch)
                                eqemu_procs=$1
                                ;;
                        ucs)
                                eqemu_procs=$1
                                ;;
                        *)
                                echo "Usage: ./eqemu one(start|stop|restart) (world|eqlaunch|ucs|eqlogin) you must also specify a valid daemon."
                                ;;
                esac
        else
                if checkyesno eqemu_eqlogin ; then 
                        eqemu_procs="${eqemu_procs}eqlogin "
                fi
                if checkyesno eqemu_world ; then
                        eqemu_procs="${eqemu_procs}world "
                fi
                if checkyesno eqemu_eqlaunch ; then
                        eqemu_procs="${eqemu_procs}eqlaunch "
                fi
                if checkyesno eqemu_ucs ; then
                        eqemu_procs="${eqemu_procs}ucs "
                fi
        fi
}
eqemu_cleanipc()
{
        eqemu_procs="world eqlaunch zone"
        for proc in ${eqemu_procs}; do
                if [ "`check_pidfile /var/run/eqemu${proc}.pid $eqemu_home/$proc`" != "" ] ; then
                        echo "Processes running; skipping cleanipc..."
                        return
                fi
        done
        echo "Cleaning IPC..."
        ${eqemu_home}/cleanipc > /dev/null 2>&1
}
eqemu_start()
{
        eqemu_determine_procs $1
        for name in ${eqemu_procs}; do 
                echo "Starting EQEmu ${name}..."
                cd ${eqemu_home}
                eval eqprocargs=\$eqemu_${name}_args
                if ! [ -e /var/run/eqemu_${name}.pid ]; then
                        touch /var/run/eqemu_${name}.pid
                        chown $eqemu_user:$eqemu_user /var/run/eqemu_${name}.pid
                fi
                /usr/sbin/daemon -f -p /var/run/eqemu_${name}.pid -u $eqemu_user $eqemu_home/$name $eqprocargs
        done
}
eqemu_stop()
{
        unset "stop_cmd"
        eqemu_determine_procs $1
        eqemu_procs=$(reverse_list ${eqemu_procs})
        for name in ${eqemu_procs}; do
                command=$eqemu_home/$name
                run_rc_command stop
        done
}
eqemu_restart()
{
        eqemu_restart_prefix=${_rc_prefix}
        run_rc_command ${eqemu_restart_prefix}stop $1
        if [ "${eqemu_restart_prefix}" != "one" ] ; then run_rc_command ${_rc_prefix}cleanipc $1; fi
        run_rc_command ${eqemu_restart_prefix}start $1
}
eqemu_status()
{
        unset "status_cmd"
        eqemu_determine_procs $1
        for name in ${eqemu_procs}; do
                command=$eqemu_home/$name
                run_rc_command status
        done
}
                        
run_rc_command "$1"
Reply With Quote
Reply

Thread Tools
Display Modes

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 09:49 AM.


 

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