Pages: [1]
  Print  
Author Topic: How to run multiple games?  (Read 15541 times)
fufinha
stop making alt accounts and self-termination
Member


Cakes 7
Posts: 584


retired


« on: December 24, 2008, 03:48:30 PM »

I got a new server and have problems with the file system since 0.7.6

How do i run multiple servers with the same fs_game name.

I set fs_homepath on each server, they are unique so they don't interfere. But downloading occurs twice if I have two servers running.

Also I have the white space issue again, on the new server. I spoke to jack thompson and he has it also. Only Cacatoes replied when I had problems with this ages ago.. I am guessing this happens on every server but doesn't affect their processes. Happens to me on Fedora and Debian.

16:49 ?        00:05:59 . oa_ded.i386 +set cvar_restart +set ...

would be good to get a response, please

Logged
Cacatoes
Banned for leasing own account
Posts a lot
*

Cakes 73
Posts: 1427


also banned for baiting another to violate rules


« Reply #1 on: December 24, 2008, 06:03:48 PM »

Me again Cheesy

On a unique machine, I run multiple servers with the same fs_game, but they run under the same user account, and so they use the same fs_homepath.

Maybe I misunderstood your problem, but,
Client-side, how can it download twice the same thing ? Does it erase the previous pk3 ?

Still no idea about this space, do you have a clue if a recent build of ioq3 (without OA diff patch) has it ?
This dot and space appears too on Tuxfamily servers, would there be much work to adapt your scripts ?
Logged

Todo: Walk the cat.
fufinha
stop making alt accounts and self-termination
Member


Cakes 7
Posts: 584


retired


« Reply #2 on: December 24, 2008, 06:55:20 PM »

suprise \Cheesy/

re: fs_game.. aah I never thought about the user account thing. Cheesy That maybe an option. I only need one folder but if I run different servers then what do specify so that the config is generated in a specific location?

I also think I have the folders in /usr/local/games/oa (i pressed tab typing that :O ) So maybe the game is reading the game location folders and thats why it requests the both of them, a bit like this...

./oa/modname/
./oa/anotherfolder/modname/ (set by fs_homepath)

Yes the download repeats twice, with same file  name shown. If the file changes then you will see it as a tmp file so I dont get the repeating thing.. (like what happens if the two files differ)

I suspected the whitespace affected everyone too but i was hoping for a fix. It affects quite alot of scripts available for gameserver management. Sad  I got someone to build it for me and.. same issue.
 
Logged
damocles
Bigger member


Cakes 0
Posts: 158


May cause drowsiness


« Reply #3 on: December 24, 2008, 06:58:04 PM »

Maybe there's something in the code or the build process that affects the process name (e.g. setproctitle).  What about the vanilla sources?
Logged
Cacatoes
Banned for leasing own account
Posts a lot
*

Cakes 73
Posts: 1427


also banned for baiting another to violate rules


« Reply #4 on: December 25, 2008, 03:02:55 AM »

Here are the scripts I use to start the server :
I run 2 servers, and so 2 scripts.

~/start-server1.sh
Code:
#!/bin/sh

#ip="192.168.0.1"
#port="27960"
name="cacatoes1"

# Which mod will we use ?
mod_name="baseoa"
#mod_name="openforts"
#mod_name="freeze"
#mod_name="animal"
#mod_name="q3pong"
#mod_name="bfpq3"
#mod_name="westernq3"
#mod_name="gridiron +set vm_game 1 +set vm_cgame 1 +set vm_ui 1 +bot_enable 0"

# Add the mod parameter or not
mod_parameter=""
if [ $mod_name != "baseoa" ]
  then mod_parameter="+set fs_game $mod_name"
fi

# go !
echo Running server $name.

screen -A -m -d -S $name /opt/openarena/oa_ded.i386 +set fs_basepath /opt/openarena +set dedicated 2 +set com_hunkMegs 96 +exec server1.cfg $mod_parameter

The main thing which differs in ~/start-server2.sh is :
Code:
+exec server1.cfg
Also the name of the screen session ($name).

Now the script I use to shut down servers :

Code:
#!/bin/sh

tmpfile=`mktemp`

ps x | grep SCREEN | grep oa |grep -v "grep" |
while read pid tty stat time command
do
  server_name=`echo $command | cut -d " " -f 6`
  echo $server_name:$pid >> $tmpfile
done

for i in `cat $tmpfile`
do
  server_name=`echo $i | cut -d ":" -f 1`
  pid=`echo $i | cut -d ":" -f 2`
  read -p "Close server \"$server_name\" ? (PID: $pid) ['o' or 'y' for yes] " answer

  case $answer in
  o|O|y|Y  ) kill $pid && echo "$server_name killed" ;;
  *)
  esac

done

Quote
I also think I have the folders in /usr/local/games/oa (i pressed tab typing that :O )
Request that feature to firefox Wink (or google chrome will steal it)

Now about file location, you shouldn't have mods installed twice (even if it's a symbolic link).
My /opt/openarena is rather empty : only files of the standard game, right after unzipping.

Then I have my "oa" user home folder, ~/.openarena
Inside of it, I have mods :
Code:
oa@loverchy:~/.openarena$ ls
animal  defrag  index.html   openforts     powerball
baseoa  freeze  missionpack  packs_defrag  q3pong

And inside baseoa, I have most pk3 files, and config files :
Code:
oa@loverchy:~/.openarena/baseoa$ ls
botlib.log              maprotation-ctf.cfg     ps5ctf.pk3
cacatoes1.log           maprotation-defrag.cfg  ps9ctf.pk3
cacatoes1.log.bak       maprotation-lms.cfg     q3config.cfg
cacatoes2.log           maprotation-noel.cfg    q3config_server.cfg
cacatoes2.log.bak       maprotation-pb.cfg      schism-b2.pk3
cubecubecube.pk3        maprotation-qpong.cfg   server1.cfg
CustomMaps              maprotation-tdm.cfg     server2.cfg
maprotation1.cfg        maprotation-wq3.cfg     server-template.cfg
maprotation2.cfg        models                  z_am_galmevish2.pk3
maprotation-animal.cfg  models_bak              z_am_mckinleyish.pk3
maprotation-bfp.cfg     oa_ctf4ishum1.pk3       z_q3dm6ish-ctf.pk3
maprotation-ctf2.cfg    oa_koth2_b2.pk3         z_q3dm6ishv3.pk3
« Last Edit: December 25, 2008, 03:05:48 AM by Cacatoes » Logged

Todo: Walk the cat.
dash9
Member


Cakes 6
Posts: 189


« Reply #5 on: December 25, 2008, 04:02:49 AM »

You could have something like:
Code:
pidfilename=/home/loverchy/.oa/$name
if [[ -f $pidfilename ]]; then
  pid=$(cat $pidfilename)
  if ps --pid "$pid"; then
    echo "Server already started: $name PID=$pid"
    exit 1
  fi
fi
cmd="screen -A -m -d -S $name /opt/openarena/oa_ded.i386 +set fs_basepath /opt/openarena +set dedicated 2 +set com_hunkMegs 96 +exec server1.cfg $mod_parameter"
eval $cmd && echo $! > $pidfilename

Then the script to shut down the servers would "know" exactly what process id to kill.
Code:
if [[ -f $pidfilename ]]; then
  pid=$(cat $pidfilename)
  ps --pid "$pid" && kill "$pid" && rm $pidfilename
fi

..but if your script works, you don't have much reason to change it, do you? Cheesy
Logged

I found a great camping place: the enemy base!
Cacatoes
Banned for leasing own account
Posts a lot
*

Cakes 73
Posts: 1427


also banned for baiting another to violate rules


« Reply #6 on: December 25, 2008, 04:58:08 AM »

Quote
..but if your script works, you don't have much reason to change it, do you?
Right, but it's always nice to learn about more elegant ways Wink

I learned shell at school some time ago but I'm no good sysadmin. :'-]
Logged

Todo: Walk the cat.
fufinha
stop making alt accounts and self-termination
Member


Cakes 7
Posts: 584


retired


« Reply #7 on: December 25, 2008, 05:35:01 AM »

thank you Cheesy

I'll try this on the new server.
Logged
fufinha
stop making alt accounts and self-termination
Member


Cakes 7
Posts: 584


retired


« Reply #8 on: December 25, 2008, 09:14:01 AM »

I looked at it a bit more and this is the way I've always set up q3 servers.

All the mods run nicely in the home folder and didnt need to care about the main game folder except putting maps in baseq3.

So I tried this and I think it's loaded without the map. Where do you have your server config and does the screen name mean user name/owner of the process? I want to keep this the same.

thank you Cheesy
Logged
Cacatoes
Banned for leasing own account
Posts a lot
*

Cakes 73
Posts: 1427


also banned for baiting another to violate rules


« Reply #9 on: December 25, 2008, 11:03:37 AM »

Quote
Where do you have your server config

It's in ~/.openarena/baseoa/

Quote
does the screen name mean user name/owner of the process?

It's arbitrary, you can name it "oa_server_one".
[ I just noticed "screen" command isn't available on my personnal machine ; maybe you'll have to install it if you want to run that script ]
If you're curious you can list screen sessions with :
Code:
screen -ls
... but normally you won't need that.
Logged

Todo: Walk the cat.
fufinha
stop making alt accounts and self-termination
Member


Cakes 7
Posts: 584


retired


« Reply #10 on: December 25, 2008, 05:45:40 PM »

Thank you Cacatoes, I got it working. Cheesy

I think this also clears up something else where some of the maps are saving in my baseoa in the home folder (on the client). You may have put map in the mod folder instead of /opt/baseoa/ ? Since I've cleaned my entire system I can see that the maps in my document home baseoa are from you.  Cheesy

I did have to delete my mod folder as I was getting some vm error.. but after removing the mod folder I only downloaded the files once and started up clean
Logged
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #11 on: December 25, 2008, 05:57:10 PM »

[ I just noticed "screen" command isn't available on my personnal machine ; maybe you'll have to install it if you want to run that script ]
If you use dash9's trick and save the pid you can use "nohup" instead of screen. It can possible save a small amount of resources by not having to emulate an VT100 terminal. You cannot reconnect to a nohup process (as far as I know) so you will need the pid to kill it.
Logged

There are nothing offending in my posts.
fufinha
stop making alt accounts and self-termination
Member


Cakes 7
Posts: 584


retired


« Reply #12 on: December 25, 2008, 07:48:13 PM »

I think I have something like this.. the brutal method Cheesy

ps -ef | grep 27960 | grep oa_ded | grep -v root | awk '{print $2}' | xargs kill $2
Logged
fufinha
stop making alt accounts and self-termination
Member


Cakes 7
Posts: 584


retired


« Reply #13 on: December 27, 2008, 05:59:54 AM »

sago do you get the white space issue too?

I have reinstalled and moved server trying to fix this. I wouldnt have needed to if I knew this was a bug

Logged
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #14 on: December 27, 2008, 06:11:39 AM »

sago do you get the white space issue too?
I do also have a white space on my server.
Logged

There are nothing offending in my posts.
Pages: [1]
  Print  
 
Jump to: