Jump to content
Sign in to follow this  
-Glen-

Linux 1.96 server quick question

Recommended Posts

Hey,

A friend of mine is having a few problems with his linux server.. its up and running fine, the only problem we are having is with mods.

Only one mod is installed on the server (finmod) and whatever we try we can't get the server to start with the mod. We're both sure that its something totally stupid, as we had the same problem before but forgot to back the server up when migrating to a more powerful machine.

Server cfg:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

!/bin/bash

#

# ofpserver: Operation Flashpoint Linux dedicated server control script

# (c) 2003 BIStudio

# OFP binary version must be 1.92 or later!

#

#=======================================================================

#======== CONFIGURATION PARAMETERS ========

#======== MUST BE EDITED MANUALLY TO FIT YOUR SYSTEM PARAMETERS ========

#=======================================================================

OFP_DIR=/opt/ofp

CONFIG=${OFP_DIR}/server.cfg

PORT=2302

PIDFILE=/var/run/ofp_server.${PORT}.pid

RUNFILE=/var/run/ofp_server.${PORT}.run

LOGFILE=${OFP_DIR}/log.${PORT}.txt

SERVER=${OFP_DIR}/server

#=======================================================================

case "$1" in

start)

if [ -f ${RUNFILE} ]; then

$0 stop

fi

echo "Starting OFP server..."

# file to mark we want server running...

echo "go" >${RUNFILE}

# launch the background watchdog process to run the server

nohup </dev/null >/dev/null $0 watchdog &

;;

stop)

echo "Stopping OFP server..."

if [ -f ${RUNFILE} ]; then

# ask watcher process to exit by deleting its runfile...

rm -f ${RUNFILE}

fi

# and terminate OFP server process

if [ -f ${PIDFILE} ]; then

kill -TERM $(< ${PIDFILE})

if [ -f ${PIDFILE} ]; then

rm -f ${PIDFILE}

fi

fi

;;

status)

if [ -f ${RUNFILE} ]; then

echo "Server should be running..."

else

echo "Server should not be running..."

fi

if [ -f ${PIDFILE} ]; then

PID=$(< ${PIDFILE})

echo "PID file exists (PID=${PID})..."

if [ -f /proc/${PID}/cmdline ]; then

echo "Server process seems to be running..."

fi

fi

;;

check)

echo -n "OFP directory: ${OFP_DIR} "

if [ -d ${OFP_DIR} ]; then

echo "OK"

else

echo "MISSING!"

fi

echo -n "Server executable: ${SERVER} "

if [ -x ${SERVER} ]; then

echo "OK"

else

echo "ERROR!"

fi

echo "Port number: ${PORT}"

echo -n "Config file: ${CONFIG} "

if [ -f ${CONFIG} ]; then

echo "OK"

else

echo "MISSING!"

fi

echo "PID file: ${PIDFILE}"

echo "RUN file: ${RUNFILE}"

;;

restart)

$0 stop

$0 start

;;

watchdog)

# this is a background watchdog process. Do not start directly

while [ -f ${RUNFILE} ]; do

# launch the server..

cd ${OFP_DIR}

#MODS=finmod

echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Starting server (port ${PORT})..."

(export LD_LIBRARY_PATH=/opt/ofp/lib;${SERVER} >>${LOGFILE} 2>&1 -server -config=${CONFIG}

-port=${PORT} -pid=${PIDFILE})

${SERVER} >>${LOGFILE} 2>&1 -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE} -mod=finmod

if [ -f ${RUNFILE} ]; then

echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Server died, waiting to restart..."

unset LD_LIBRARY_PATH

sleep 5s

else

echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Server shutdown intentional, watchdog terminating"

unset LD_LIBRARY_PATH

fi

done

;;

*)

echo "$0 (start|stop|restart|status|check)"

;;

esac

So any pointers on getting the server to start with finmod ?

Share this post


Link to post
Share on other sites

there is a fix for this, there was allot of talk about the FCM and the linux based servers, it's a minor fix, but you'll have to wait for benu to replie

I know if you search for

linux server FCM

it should show up

Share this post


Link to post
Share on other sites
@ Feb. 01 2005,03:03)]Only one mod is installed on the server (finmod) and whatever we try we can't get the server to start with the mod. We're both sure that its something totally stupid, as we had the same problem before but forgot to back the server up when migrating to a more powerful machine.

First, you start the server two times, first times without any mods but with compatibility libs, and after that one time with a modfolder. Second, the finmod (and other mods using cpp files) needs its cpp files copied to the ofp server root. You should change the following lines:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"># launch the server..

cd ${OFP_DIR}

#MODS=finmod

echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Starting server (port ${PORT})..."

(export LD_LIBRARY_PATH=/opt/ofp/lib;${SERVER} >>${LOGFILE} 2>&1 -server -config=${CONFIG}

-port=${PORT} -pid=${PIDFILE})

${SERVER} >>${LOGFILE} 2>&1 -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE} -mod=finmod

to this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"># launch the server..

cd ${OFP_DIR}

#sets modfolders

#can be set to MODS="" to play without modfolders

MODS="finmod"

#path to compatibility libs

COMP_LIBS="/opt/ofp/lib"

#remove cpp files from previous mods

rm -f ${OFP_DIR}/resource.cpp ${OFP_DIR}/config.cpp 2>/dev/null

#check each modfolder in sequence for cpp files

#and copy them to the server root

for mod in $(echo $MODS|tr ';' ' '); do cp -f ${OFP_DIR}/${mod}/bin/{resource,config}.cpp ${OFP_DIR};done

echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Starting server (port ${PORT})..."

if [[ $MODS != '' ]]; then

export LD_LIBRARY_PATH=${COMP_LIBS}

${SERVER} >>${LOGFILE} 2>&1 -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE}) -nomap -mod=${MODS}

unset LD_LIBRARY_PATH

else

export LD_LIBRARY_PATH=${COMP_LIBS}

${SERVER} >>${LOGFILE} 2>&1 -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE}

unset LD_LIBRARY_PATH

fi

And i would put variables like MODS and COMP_LIBS to the top of the file actually, so you only have to look in one place when changing things like pathnames etc.

Share this post


Link to post
Share on other sites

Not really, although i don't think you really need it if you don't use any inofficial addons (assuming inofficial addons will be used from modfolders only). I didn't do too much testing with nomap for servers yet, so i wasn't sure if i should include it at all, but iirc it made a difference for us (our gdt modfolder is >1gb).

Share this post


Link to post
Share on other sites

with all the server types we have run we have not seen any differences with -nomap

i beleave nomap is used for graphic cards so they dont pre map the addons, but who knows

Share this post


Link to post
Share on other sites
i beleave nomap is used for graphic cards so they dont pre map the addons, but who knows

nomap explanation from version history:

Different file-acess technique used when memory mapping fails.

Quote[/b] ]

Memory Mapping from www.unet.univie.ac.at

Memory mapped files provide a mechanism for a process to access files by directly incorporating file data into the process address space. The use of mapped files can significantly reduce I/O data movement since the file data does not have to be copied into process data buffers, as is done by the read and write subroutines. When more than one process maps the same file, its contents are shared among them, providing a low-overhead mechanism by which processes can synchronize and communicate.

Mapped memory regions, also called shared memory areas, can serve as a large pool for exchanging data among processes. The available subroutines do not provide locks or access control among the processes. Therefore, processes using shared memory areas must set up a signal or semaphore control method to prevent access conflicts and to keep one process from changing data that another is using. Shared memory areas can be most beneficial when the amount of data to be exchanged between processes is too large to transfer with messages, or when many processes maintain a common large database.

In conclusion you can say if your app has to use external I/O, memory mapping provides a shared adress pool which is reducing read and write operations and therefore fast up your application.

The different techniques are MMAP and SHMAT

Quote[/b] ]

from www.unet.univie.ac.at

Use the shmat services under the following circumstances:

For 32-bit application, eleven or fewer files are mapped simultaneously, and each is smaller than 256MB.

When mapping files larger than 256MB.

When mapping shared memory regions which need to be shared among unrelated processes (no parent-child relationship).

When mapping entire files.

Use mmap under the following circumstances:

Portability of the application is a concern.

Many files are mapped simultaneously.

Only a portion of a file needs to be mapped.

Page-level protection needs to be set on the mapping.

Private mapping is required.

I would say they used the SHMAT method for their own memory mapping cause of the file sizes. SHMAT is more efficient on bigger files than MMAP.

What the other technique is when memory mapping fails I can't say. But I guess they always use memory mapping but before 1.92 they used MMAP and than added the nomap option for switching to SHMAT... Dunno if it's right.

Share this post


Link to post
Share on other sites

Thanks for all your help, we got it up and running with Finmod last night and enjoyed some lag free CTI.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×