Jump to content
Sign in to follow this  
Serjevski

Linux dedicated server run with mods

Recommended Posts

I've installed Linux dedicated serve saccessfully? it runs missions that doesn't requre any mods, but when I try to run server with mods it doesn't see them.

Here is my server startup script:

#!/bin/bash
#
# armaserver: ArmA 2 Linux Dedicated Server Control Script
#  (c) 2010 BIStudio
#  ArmA 2 binary version must be 1.04 or later
#

#=======================================================================
#========               CONFIGURATION PARAMETERS                ========
#======== MUST BE EDITED MANUALLY TO FIT YOUR SYSTEM PARAMETERS ========
#=======================================================================
ARMA_DIR=/home/arma/aoa2server
CONFIG=server.cfg
PORT=2302
PIDFILE=${ARMA_DIR}/${PORT}.pid
RUNFILE=${ARMA_DIR}/${PORT}.run
LOGFILE=${ARMA_DIR}/log.${PORT}.log
ERRRORLOG=${ARMA_DIR}/error.${PORT}.log
SERVER=${ARMA_DIR}/server
OTHERPARAMS=
MODS=-"mod ${ARMA_DIR}/@cba;${ARMA_DIR}/@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy;@i44;@lingor;@namalsk;@thirsk;@wintercamos;"

#=======================================================================
ulimit -c 1000000

case "$1" in


   start)
if [ -f ${RUNFILE} ]; then
    $0 stop
fi
echo "Starting ArmA 2 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 ArmA 2 server..."
if [ -f ${RUNFILE} ]; then
# ask watcher process to exit by deleting its runfile...
    rm -f ${RUNFILE}
fi
# and terminate ArmA 2 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 "ArmA 2 directory: ${ARMA_DIR} "
if [ -d ${ARMA_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 ${ARMA_DIR}
    echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Starting server (port ${PORT})..."
    ${SERVER} >>${LOGFILE} 2>>${LOGFILE} -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE} ${OTHERPARAMS} \"${MODS}\"
    if [ -f ${RUNFILE} ]; then
	echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Server died, waiting to restart..."
	sleep 5s
    else
	echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Server shutdown intentional, watchdog terminating"
    fi
done
;;
   *)
echo "$0 (start|stop|restart|status|check)"
;;
esac

Here is ps output:

ps aux | grep server
root     23656  0.1  0.1   5428  1448 pts/0    S    11:13   0:00 /bin/bash /etc/init.d/arma2oaserver watchdog
root     23658  101 21.2 235992 217452 pts/0   Rl   11:13   0:07 /home/arma/aoa2server/server -server -config=server.cfg -port=2302 -pid=/home/arma/aoa2server/2302.pid "-mod /home/arma/aoa2server/@cba;/home/arma/aoa2server/@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy;@i44;@lingor;@namalsk;@thirsk;@wintercamos;"

All mod files and folders are lowecase and located in /home/arma/aoa2server directory

Share this post


Link to post
Share on other sites

For some reason you are using a modified start script that doesn't use "OTHERPARAMS" to add the -mod=... startup parameter there. Now, to fix your variant of the script, change this:

MODS=-"mod ${ARMA_DIR}/@cba;${ARMA_DIR}/@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy;@i44;@lingor;@namalsk;@thirsk;@wintercamos;"

into

MODS="-mod=@cba;@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy;@i44;@lingor;@namalsk;@thirsk;@wintercamos"

and

${SERVER} >>${LOGFILE} 2>>${LOGFILE} -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE} ${OTHERPARAMS} \"${MODS}\"

into

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

Edited by Killswitch

Share this post


Link to post
Share on other sites
Change this:

MODS=-"mod ${ARMA_DIR}/@cba;${ARMA_DIR}/@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy;@i44;@lingor;@namalsk;@thirsk;@wintercamos;"

into

MODS="-mod=@cba;@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy;@i44;@lingor;@namalsk;@thirsk;@wintercamos"

and

${SERVER} >>${LOGFILE} 2>>${LOGFILE} -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE} ${OTHERPARAMS} \"${MODS}\"

into

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

Thanks, I alredy found error, missed = (equal sign) between =-mod and modlist :)

Share this post


Link to post
Share on other sites

No need to do that. Just place mod line in OTHERPARAMS line like this

OTHERPARAMS='-cfg=arma2oa.cfg -cpucount=4 -exThreads=7'
OTHERPARAMS=-mod=@cba\;@cba_a2\;@cba_oa\;@ace\;@acex\;@acex_ru\;@acex_usnavy\;@acre\;

And no further edits needed.

Share this post


Link to post
Share on other sites
No need to do that. Just place mod line in OTHERPARAMS line like this

OTHERPARAMS='-cfg=arma2oa.cfg -cpucount=4 -exThreads=7'
OTHERPARAMS=-mod=@cba\;@cba_a2\;@cba_oa\;@ace\;@acex\;@acex_ru\;@acex_usnavy\;@acre\;

And no further edits needed.

Actually twice OTHERPARAMS= should mean only the last line is actually active, and the first one is ignored?

Share this post


Link to post
Share on other sites
No need to do that. Just place mod line in OTHERPARAMS line like this

OTHERPARAMS='-cfg=arma2oa.cfg -cpucount=4 -exThreads=7'
OTHERPARAMS=-mod=@cba\;@cba_a2\;@cba_oa\;@ace\;@acex\;@acex_ru\;@acex_usnavy\;@acre\;

And no further edits needed.

Actually, you do not need 2 OTHERPARAMS lines. If you surround the whole line with quotes, then do not use the backslash between mods, and vice versa.

examples:

OTHERPARAMS='-mod=@cba;@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_usnavy;@acre'

or

OTHERPARAMS=-mod=@cba\;@cba_a2\;@cba_oa\;@ace\;@acex\;@acex_ru\;@acex_usnavy\;@acre\;

You also do not need these commands "-cfg=arma2oa.cfg -cpucount=4 -exThreads=7", in the server launch script the config file is defined, putting it here is redundant. The auto-detect for cores and threads also works flawlessly, therefore the cpucount and exthreads would really only be needed if you were only wanted to use less cpu and threads.

KillSwitchs' isn't required to add the 'MODS' section, all the mods are on the 'OTHERPARAMS' line, again this is redundant.

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

Less, scripting is more efficient than putting the same information in twice, or 3 times.

...Syn...

Edited by VisceralSyn
Dang gumbed typos....

Share this post


Link to post
Share on other sites

Ok, thank you all :) it works now. My main mistake was forgotten = between -mod switch and list of mods.

Here is my final, working script:

#!/bin/bash
#
# armaserver: ArmA 2 Linux Dedicated Server Control Script
#  (c) 2010 BIStudio
#  ArmA 2 binary version must be 1.04 or later
#

#=======================================================================
#========               CONFIGURATION PARAMETERS                ========
#======== MUST BE EDITED MANUALLY TO FIT YOUR SYSTEM PARAMETERS ========
#=======================================================================
ARMA_DIR=/opt/arma2server
CONFIG=server.cfg
PORT=2302
PIDFILE=${ARMA_DIR}/${PORT}.pid
RUNFILE=${ARMA_DIR}/${PORT}.run
LOGFILE=${ARMA_DIR}/log.${PORT}.log
SERVER=${ARMA_DIR}/server
OTHERPARAMS=-cpucount=2
CBA="@cba_a2;@cba_oa;@cba"
ACE="@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy"
EXP="arma2;expansion;expansion\beta"
MODS="${EXP};${CBA};${ACE};@fallujah;@jsrs;@brg_africa;@chn_crocodile;@ibr_dtowns;@ibr_lcivilians;@ibr_plants;@mbg_buildings2;@lingor;@csj_snake;@namalsk"
#;${CBA};@asr_ai;${ACE};;;@isla_duala;;;"


#=======================================================================
ulimit -c 1000000

case "$1" in


   start)
if [ -f ${RUNFILE} ]; then
    $0 stop
fi
echo "Starting ArmA 2 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 ArmA 2 server..."
if [ -f ${RUNFILE} ]; then
# ask watcher process to exit by deleting its runfile...
    rm -f ${RUNFILE}
fi
# and terminate ArmA 2 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 "ArmA 2 directory: ${ARMA_DIR} "
if [ -d ${ARMA_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 ${ARMA_DIR}
    echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Starting server (port ${PORT})..."
    sudo -u arma ${SERVER} >>${LOGFILE} 2>&1 -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE} -mod=${MODS} ${OTHERPARAMS}
    if [ -f ${RUNFILE} ]; then
	echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Server died, waiting to restart..."
	sleep 5s
    else
	echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Server shutdown intentional, watchdog terminating"
    fi
done
;;
   *)
echo "$0 (start|stop|restart|status|check)"
;;
esac

Share this post


Link to post
Share on other sites
Actually twice OTHERPARAMS= should mean only the last line is actually active, and the first one is ignored?

Well I did not knew that. Thanks.

Actually, you do not need 2 OTHERPARAMS lines. If you surround the whole line with quotes, then do not use the backslash between mods, and vice versa.

examples:

OTHERPARAMS='-mod=@cba;@cba_a2;@cba_oa;@ace;@acex;@acex_ru;@acex_usnavy;@acre'

or

OTHERPARAMS=-mod=@cba\;@cba_a2\;@cba_oa\;@ace\;@acex\;@acex_ru\;@acex_usnavy\;@acre\;

You also do not need these commands "-cfg=arma2oa.cfg -cpucount=4 -exThreads=7", in the server launch script the config file is defined, putting it here is redundant. The auto-detect for cores and threads also works flawlessly, therefore the cpucount and exthreads would really only be needed if you were only wanted to use less cpu and threads.

KillSwitchs' isn't required to add the 'MODS' section, all the mods are on the 'OTHERPARAMS' line, again this is redundant.

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

Less, scripting is more efficient than putting the same information in twice, or 3 times.

...Syn...

Are you saying that linux server reads arma2oa.cfg automatically so I do not need to specify it in the script?

Sorry for thread hijack, thats not my intention but I figure why making new one if were here already.

And this what you made actually works?

#!/bin/bash
#
# armaserver: ArmA 2 Linux Dedicated Server Control Script
#  (c) 2010 BIStudio
#  ArmA 2 binary version must be 1.04 or later
#

#=======================================================================
#========               CONFIGURATION PARAMETERS                ========
#======== MUST BE EDITED MANUALLY TO FIT YOUR SYSTEM PARAMETERS ========
#=======================================================================
ARMA_DIR=/opt/arma2server
CONFIG=server.cfg
PORT=2302
PIDFILE=${ARMA_DIR}/${PORT}.pid
RUNFILE=${ARMA_DIR}/${PORT}.run
LOGFILE=${ARMA_DIR}/log.${PORT}.log
SERVER=${ARMA_DIR}/server
OTHERPARAMS=-cpucount=2
CBA="@cba_a2;@cba_oa;@cba"
ACE="@ace;@acex;@acex_ru;@acex_sm;@acex_usnavy"
EXP="arma2;expansion;expansion\beta"
MODS="${EXP};${CBA};${ACE};@fallujah;@jsrs;@brg_africa;@chn_crocodile;@ibr_dtowns;@ibr_lcivilians;@ibr_plants;@mbg_buildings2;@lingor;@csj_snake;@namalsk"
#;${CBA};@asr_ai;${ACE};;;@isla_duala;;;"


#=======================================================================
ulimit -c 1000000

Didn't copy complete script but those lines CBA="" ACE="" EXP="" are not necessary. Also do we need expansion\beta and arma2 in mod launch lines? I was looking at my server trough Six updater and everything is fine ( when looking at signatures all green ) except modcheck which says bad for some reason and I cant find a way how to fix that. Says not allowed mods expansion\beta and missing or disabled mods for all the others I run?

Edited by _MaSSive

Share this post


Link to post
Share on other sites

If you are running the Beta OA server from the \expansion\beta directory, yes you'll need that on the 'OTHERPARAMS' line. And yes, the OA/CO server reads the arma2oa.cfg by default, if you wanted to use a different config file, then the '-cfg=****' would be required.

What I don't understand is the bloating the script with extra garbage, when all the commandline switches work from the 'OTHERPARAMS' line, as intended by BIS. I was taught the less stuff in the script the more efficient it is, for administrating on Linux. What I keep seeing here, is the script being bloated, more and more.

...Syn...

Edited by VisceralSyn
Dang gumbed typos....

Share this post


Link to post
Share on other sites

I undertand what youre saying but sometimes with a lot of mods line can become very long and this might reduce clutter and youll have better preview. I unlcluded solution like this to mine script.

#!/bin/bash
#
# armaserver: ArmA 2 Linux Dedicated Server Control Script
#  (c) 2010 BIStudio
#  ArmA 2 binary version must be 1.04 or later
#

#=======================================================================
#========               CONFIGURATION PARAMETERS                ========
#======== MUST BE EDITED MANUALLY TO FIT YOUR SYSTEM PARAMETERS ========
#=======================================================================
ARMA_DIR=/path/to/my/server
CONFIG=acexsrv.cfg
PORT=2433
PIDFILE=${ARMA_DIR}/${PORT}.pid
RUNFILE=${ARMA_DIR}/${PORT}.run
LOGFILE=${ARMA_DIR}/log.${PORT}.txt
SERVER=${ARMA_DIR}/server
OTHERPARAMS='-cfg=arma2oa.cfg -cpucount=3'
CBA="@cba;@cba_a2;@cba_oa"
ACE="@ace;@acex;@acex_ru;@acex_usnavy;@zeu_ai_ace"
ACRE="@acre"
EXP="arma2;expansion;expansion\beta"
MODS="${EXP};${CBA};${ACE};${ACRE};@fallujah;@server"
#=======================================================================

Again its not a question of efficiency but better preview. Working over ssh can be tiresome sometimes and small typo makes big headaches. Been there already.

Edited by _MaSSive

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  

×