Web Hosting Talk







View Full Version : How to starting game servers


SynHost
02-02-2003, 03:20 PM
Hi -

Right now I start up my game servers by manually typing:

nohup ./hlds_run -game cstrike etc...

for every game server one by one. I've tried putting all these commands in a shell script and executing it, but it doesn't work correctly. It seems to run hlds_run, but hlds_run doesn't spawn off an instance of hlds as it should. Also, i've been using nohup to keep the server running after shell logout, is this ok? Does anyone have any ideas on how to put all the server startup commands into one script - I need this to be able to start all servers when my box boots up.

Thanks for any input,
Ben Hughes

hotice007
02-02-2003, 04:08 PM
Use screens:

screen -A -m -d -S csServer ./hlds_run -game cstrike +ip 12.234.56.78 +maxplayers 20 +map de_dust

pyoor
02-02-2003, 06:51 PM
I would put an ampersand at the end of the line...

nohup ./hlds_run -game cstrike &

or the good ol' screen method hotice007 posted works just as well ;) In any case... counterstrike stinks. You should host continuum (subspace) games instead hehe...

---www.sekure.us---

James[UH]
02-02-2003, 06:59 PM
www.gameadmins.com

SynHost
02-03-2003, 12:15 AM
Hi -

Thanks I'll give screen a try.

I did try using the & at the end but that still didn't seem to work.

Ben

innova
02-03-2003, 02:25 AM
NO NO NO

Screen is not EVER necessary, in fact I hate it with a vengeance. Just another nasty bit of complexity.

Quite simply:

Put all your commandline variables in autoexec.cfg (IP, port, maxplayers, map, etc)

Then, make this script:

#!/bin/bash
while true
do
./executable +exec server.cfg
echo "Server crashed on `date`" >> crashlog.txt
done

Chmod 0700 script

./script &

Done.

Do away with all that complexity!!!!!!!!!!!

That was a very simple one. You may wish to include a waiting period so that crashing servers dont thrash the disk, a port-based monitor to detect for zombied servers, etc.. the sky is the limit.

Check out hlds_run for more examples. Its not an executable binary, its a shell script.

innova
02-03-2003, 03:33 AM
BTW this works for any game I have ever tested.

Way to be universal!

Silent Night
06-15-2003, 11:48 PM
a simple bash file is what i use

PM me for more info