Jump to content
Sign in to follow this  
likuid

Linux start/stop script problems

Recommended Posts

Hi everyone. =)

I recently installed and configured an arma2 v1.05 dedicated server on a centos4.8 i386 configuration and, before I decided to post this thread I checked BIS forums, Armaholic, KellysHeros, and several misc. forums and threads compliments of Google with no luck.

If this problem has already been addressed I apologize for wasting server space and the community's time.

I can run the service fine by using;

'./server'

and I am able to see and play on the server but I am unable to define my custom mods so that they will be loaded as well.

'ps -ef | grep server' shows

arma2user 18924 12469 26 17:07 pts/1 00:00:06 ./server

However, if I attempt to start the service using;

'./arma2server start'

the service appears to start, a

'ps -ef | grep 2302' returns;

arma2user 19075 19073 99 17:18 pts/1 00:00:03 ./server -server -config=server.cfg -port=2302 -pid=./2302.pid

but the problem is that I am unable to see the server in the server list in game much less join.

I have attempted several modifications to the context of arma2server and have seen no change.

my output from;

'./arma2server check'

[arma2user@arma2server arma2]$ ./arma2server check

ArmA 2 directory: . OK

Server executable: ./server OK

Port number: 2302

Config file: server.cfg OK

PID file: ./2302.pid

RUN file: ./2302.run

The context within arma2server;

ARMA_DIR=.

CONFIG=server.cfg

PORT=2302

PIDFILE=${ARMA_DIR}/${PORT}.pid

RUNFILE=${ARMA_DIR}/${PORT}.run

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

SERVER=${ARMA_DIR}/server

I had attempted to hard link arma2server to /etc/rc.d/init.d/arma2server and run a chkconfig but the return value was;

service arma2server does not support chkconfig

I have successfully chkconfig on the original arma 1.14 dedicated file so im not sure if this is a potential clue or not.. I know in the readme.txt it specifies that you can do the same as with arma armaserver using chkconfig so I thought I would mention it just in case.

Any help would be greatly appreciated as I have spent over 18 hours now trying to determine the cause of the arma2server script problem.

I have run strace and several other logging/tracing methods to try and spot some sort of error being thrown but have not seen anything that would indicate a/the problem.

Any advice would be greatly appreciated.

Please let me know specifically which files and/or output you require to help diagnose the issue and I will be more than happy to post the info.

Thank you in advance,

Likuid_the_White_Devil

Edited by likuid

Share this post


Link to post
Share on other sites

Can you connect to the server directly over IP?

If so please paste your config.cfg

Share this post


Link to post
Share on other sites
Can you connect to the server directly over IP?

If so please paste your config.cfg

Hi Deadfast,

I am able to connect using the direct IP only if the service is started via;

'./server' from the root arma2 path.

but am not able to connect or see the server at all using;

'./arma2server start' script either from the arma2 root path or from /etc/rc.d/init.d/arma2server start.

/home/arma2user/arma2/server.cfg

password = "playerpassword";

passwordAdmin = "adminpassword";

hostname="myserver";

motd[]=
{
"Welcome!!!",
};

motdInterval=50;

voteThreshold=0.25;

maxPlayers=10;

reportingIP="arma2pc.master.gamespy.com";
reportingIP="192.168.1.15";

logfile="ARMA2-Dedi.log";

/*
mission list template

class Mission_
{
template =;
       difficulty = "expert";
};
*/

class Missions {

class Mission_1
{
template =mymission.chernarus;
       difficulty = "expert";
};

voteMissionPlayers=1;

kickduplicate=1;

equalModRequired=1;

disableVoN=1;

vonCodecQuality=7;

timeStampFormat=full;

persistent=0;

verifySignatures=1;

// Signature timeout fix
regularcheck="{}";

// EOF

I have changed the equalModRequired= off and on with no change.

/home/arma2user/arma2/arma2server

#!/bin/bash
#
# armaserver: ArmA 2 Linux Dedicated Server Control Script
#  (c) 2009 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/arma2user/arma2
ARMA_DIR=.
CONFIG=server.cfg
PORT=2302
PIDFILE=${ARMA_DIR}/${PORT}.pid
RUNFILE=${ARMA_DIR}/${PORT}.run
LOGFILE=${ARMA_DIR}/log.${PORT}.txt
SERVER=${ARMA_DIR}/server
#MOD=mod=@rcir_UN\;@extra_units_and_vehicles\;@merc_rep\;@merc_units_fixed\;@landtex\;@belsebub\;@ins\;@cba\;@vfai\;@rteditor\;@jon_editorupdate\;@map\;@troopmon2\;@desertisland\;@panthera\;@sap
#=======================================================================
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>&1 -server -config=${CONFIG} -port=${PORT} -pid=${PIDFILE}
           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

In case it might help.

All files in /home/arma2user/arma2/ (including arma2/) are owned by arma2user UID and arma2user GID. I have not modified the chmod permissions at all.. The chmod permissions are as they were when un-tar'd.

[ arma2user@arma2server arma2]$ ls -l
total 41472
drwxrwxr-x  2 arma2user arma2user     4096 Feb 27 12:37 addons
-rw-------  1 arma2user arma2user      124 Feb 27 18:51 arma2.cfg
-rwxrwxr-x  1 arma2user arma2user  9452617 Feb 27 01:35 arma 2_manual_us.pdf
-rwxrwxr-x  2 arma2user arma2user     2996 Feb 27 17:05 arma2server
-rw--w----  1 arma2user arma2user 16250880 Feb 27 13:35 arma2server-1.05.62021.tar
drwxrwxr-x  2 arma2user arma2user     4096 Feb 27 13:41 battleye
drwxrwxr-x  2 arma2user arma2user     4096 Feb 27 01:35 BattlEye
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @belsebub
-rwxrwxr-x  1 arma2user arma2user      148 Feb 27 01:36 bis.url
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 01:36 @cba
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 01:36 @desertisland
drwxrwxr-x  2 arma2user arma2user     4096 Feb 27 01:36 dta
-rw-rw-r--  1 arma2user arma2user      608 Feb 27 16:39 err.txt
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @extra_units_and_vehicles
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @ins
-rwxrwxr-x  1 arma2user arma2user      227 Feb 27 13:35 install
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 01:36 @jon_editorupdate
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @landtex
-rw-rw-r--  1 arma2user arma2user   123158 Feb 27 18:51 log.2302.txt
-rw-rw-r--  1 arma2user arma2user     3843 Feb 27 13:12 log.2302.txt.bkp
-rw-rw-r--  1 arma2user arma2user    50446 Feb 27 16:43 log.2302.txt.bkp2
-rw-rw-r--  1 arma2user arma2user     1561 Feb 27 17:00 log..txt
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @map
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @merc_rep
drwxrwxr-x  4 arma2user arma2user     4096 Feb 27 12:37 @merc_units_fixed
drwxrwxr-x  2 arma2user arma2user     4096 Feb 27 12:37 missions
drwxrwxr-x  2 arma2user arma2user     4096 Feb 27 15:29 mpmissions
-rw-rw-r--  1 arma2user arma2user       26 Feb 27 16:38 out.txt
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 01:39 @panthera
drwx-wx--x  2 arma2user arma2user     4096 Feb 27 12:38 player
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @rcir_un
-rw-rw-r--  1 arma2user arma2user     2315 Feb 27 13:02 readme_server.txt
-rwxrwxr-x  1 arma2user arma2user     2315 Feb 27 13:35 readme.txt
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @rteditor
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 01:40 @sap
-rwxrwxr-x  1 arma2user arma2user 16138960 Feb 27 13:35 server
-rw-rw-r--  1 arma2user arma2user    10761 Feb 27 18:51 server.cfg
-rw-rw-r--  1 arma2user arma2user    12814 Feb 27 12:37 strace.out
-rwxrwxr-x  1 arma2user arma2user     6520 Feb 27 13:36 tolower
-rw-rw-r--  1 arma2user arma2user     3040 Feb 27 13:35 tolower.c
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @troopmon2
-rwxrwxr-x  1 arma2user arma2user     1943 Feb 27 01:40 uninstall.csv
-rwxrwxr-x  1 arma2user arma2user    10359 Feb 27 01:40 uninstall.log
drwxrwxr-x  3 arma2user arma2user     4096 Feb 27 12:37 @vfai

Edited by likuid
added arma2 root perms list

Share this post


Link to post
Share on other sites

Your server.cfg has two issues:

reportingIP is listed twice, and class Missions is missing a closing bracket.

Share this post


Link to post
Share on other sites
Your server.cfg has two issues:

reportingIP is listed twice, and class Missions is missing a closing bracket.

The closing bracket is missing from the class Missions simply because I cut my 80 some odd mission list down for the sake of the reader and must have missed that I did not add the closing bracket for the thread post. Also, I have tested the multiple reportingIP's in both arma and arma2 and it allows for me to connect to the dedicated server on my lan as well as report to the gamespy master server.

The multiple IP's have been commented down to only one for trouble shooting reasons but, having both on works fine in my case as I am able to see the server locally and my friends are able to find it no problem publicly.

Thank you for the response, but I am afraid the problem is likely related to something else that I am entirely unaware of what could be culprit at this point.

If you prefer I can edit my post and enter the content of my server.cfg in it's complete entirety but, I don't think the server.cfg is the problem as the server.cfg is read and comprehended fine by running server itself and, the way I understand the arma2server script is that aside from adding mods it simply calls upon server which in turn utilizes the server.cfg which makes me think that the server.cfg is fine. Otherwise it too would exhibit the same problem as the arma2server script. I may be wrong and, interpreting the arma2server script incorrectly. If I am please let me know.

Again, thank you for the response Hitman.

Share this post


Link to post
Share on other sites

I had trouble with the arma2server script as well.

I decided to just run arma2 as:

./server -config=server.cfg -port=2302

Share this post


Link to post
Share on other sites

Hi

I think u have problem in your

/home/arma2user/arma2/arma2server

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

if [ -f ${RUNFILE} ]; then

try this:

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

I had same problem and it took me quite long time until I solve it.

Share this post


Link to post
Share on other sites
Hi

I think u have problem in your

/home/arma2user/arma2/arma2server

I made the modification to /home/arma2user/arma2server as you suggested but unfortunately that did not seem to make a difference at all.

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

Perhaps I did something incorrectly but I do not think so.

Just out of curiosity I rebooted my server to try and kill any defunct or dead PID files and that too turned up nothing.

:(

Perhaps you or someone else could post your working arma2server, server.cfg, and arma2.cfg contents for me to test on my server.

As I am able to host the server using just ./server, I would very much like to be able to host a server that supports my custom content.

Thank you,

likuid

Edited by likuid

Share this post


Link to post
Share on other sites

The script doesn't do anything special. It just sticks the parameters together an executes them.

It also allows you to shut down the process, but nothing you could kill yourself.

If you are OK running the server app directly you can simply use:

./server -config=server.cfg -port=2023 -mod=@mod1;@mod2;@mod3

Edited by Deadfast

Share this post


Link to post
Share on other sites
The script doesn't do anything special. It just sticks the parameters together an executes them.

It also allows you to shut down the process, but nothing you could kill yourself.

If you are OK running the server app directly you can simply use:

./arma2server -config=server.cfg -port=2023 -mod=@mod1;@mod2;@mod3

I could try that.. I am at work so I can not test it right now. But my problem seems to be that arma2server does not start an accessible server. The processes run but there is nothing reported to ArmA2 at all in the way of available games on the host and even with the server run by itself I am not able to see 2302 as a listening port although I am able to join so there is really no way for me to test if arma2server is listening on port 2302 other than trying to list/join the server from within ArmA2.

Would using ./server with the suggested options work at all?

EDIT

Ok, so.. Using ./server -mod=@mod1\;

Works great to call the mods. However, I tried to define my server.cfg file.. and guess what.. It hated it. Fails everytime and I get a Preprocessor failed on file server.cfg - error 7.

So now I'm thinking my server.cfg is just all out of line.

The reason I thought having 2 report to IP addresses defined was working is because my server.cfg is NOT being called upon at all by ./server unless I tell it to do so to Hitman, I apologize as I was incorrect.

I re-wrote my server.cfg and kept it as basic as possible and I am now able to get server to function with my server.cfg being called and..... arma2server script is working fine.. I suppose I need to very slowly rewrite my server.cfg and try to find my set backs.

Thanks to all who helped me in this thread. Go figure it's a pebcak issue. I should have known better. Sorry for wasting everyones time on a noobish mistake. I hope that some other poor "noob" finds this useful.

Thanks everyone for all the pointers, you helped me get up and running!!!:yay:

Edited by likuid
Tested Deadfast's and Rothgar's suggestions.

Share this post


Link to post
Share on other sites

I'm glad you got it to work in the end.

I just noticed I made a mistake in my previous post - I confused the shell script and the actual server executable. I hope it didn't confuse you too much, sorry.

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  

×