11-19-2008, 09:37 PM (This post was last modified: 11-19-2008, 09:53 PM by Firefox005.)
Barebones for setting up a L4D server, assumes you already have all the files, hldsupdatetool, etc installed might update later but there are already numerous guides for that.
Here is a sample cfg file, name these server_01.cfg, server_cfg02.cfg, etc for as many server as you plan on running with –fork.
Code:
// server name
hostname "L4D Server"
// rcon passsword
rcon_password "password"
// server logging
log on
sv_logbans 1
sv_logecho 1
sv_logfile 1
sv_log_onefile 0
// operation
sv_lan 0
sv_region 0
sv_contact “email@me.com”
sv_steamgroup XXXXXXXX //Set this to your Steam Group ID, on the admin page for the group
sv_steamgroup_exclusive 0 //Allows only members of the steamgroup to join first, after that it is publicly joinable.
xxxx+## start incrementing from that number ie 27015+## starts at 27015, while 270## starts at 27001.
You can leave off client, host, match, system, and steam ports if you wish the servers to auto find ports however there could potentially be conflicting ports and you cannot guarantee which server_cfg##.cfg is set to which server, ie 27015 could be server_cfg03.cfg.
It has been hinted that the client, match and system ports will soon be deprecated as they are xbox specific and not needed on PC.
Only enable netconport if you know what you are doing and have set a netconport password. With netconportpassword you must enter PASS xxxx before it will accept any commands.
Here are the commands that you can run if you telnet into the parent process if using fork (in this case netconport will be 9000 for the parent).
Code:
Status see status of all children.
Shutdown cleanly shutdown the server when all games have finished.
broadcast <cmd> execute the console command 'cmd' on all active subprocesses.
Finally here is a useful init.d script for running this in a screen, and automatically starting on OS’s that support chkconfig. I got this for somewhere and modified it a bit, so kudos to whoever made it first.
To enable chkconfig do:
Code:
chkconfig --add l4d
assuming you named the file l4d. (/etc/init.d/l4d)
Code:
#!/bin/bash
#
# chkconfig: 2345 20 80
# description: Left 4 Dead Server Init Script
# Server options
TITLE='L4D Dedicated Server'# Script initialization title
LONGNAME='Left 4 Dead' # Full title of game type
NAME='l4d' # Server handle for the screen session
DAEMON='srcds_run' # The server daemon
STEAM='location of scrds_run' # STEAM to Steam installation
# Game options
IP='a.b.c.d' # IP of the server
MAP='l4d_vs_hospital01_apartment' # Initial map to start
GAME='left4dead' # Game type (tf|cstrike|valve|hl2mp)
FORK='4' # of server instances
CLIENT='27005' # Client Ports
HOST='27015' # Host Ports
MATCH='27025' # Match Ports
SYSTEM='27035' # System Ports
STEAMPORT='27690'
# Screen command
INTERFACE="/usr/bin/screen -A -m -d -S $NAME"
start() {
# Check if the pid files currently exist
if [ ! -f $STEAM/$GAME/$NAME.pid ] && [ ! -f $STEAM/$GAME/$NAME-screen.pid ]; then
if [ -x $STEAM/$DAEMON ]; then
touch /var/lock/subsys/$NAME
echo "Starting $TITLE - $LONGNAME"
echo "Server IP: $IP"
echo "Server ports: $CLIENT, $HOST, $MATCH, $SYSTEM, STEAMPORT + $FORK"
cd $STEAM
$INTERFACE $STEAM/$DAEMON $OPTS
# Prevent race condition on SMP kernels
sleep 1
# Find and write current process id of the screen process
ps -ef | grep SCREEN | grep "$NAME" | grep -v grep | awk '{ print $2}' > $STEAM/$GAME/$NAME-screen.pid
echo "$TITLE screen process ID written to $STEAM/$GAME/$NAME-screen.pid"
echo "$TITLE server process ID written to $STEAM/$GAME/$NAME.pid"
echo "$TITLE started."
fi
else
echo -e "Cannot start $TITLE. Server is already running."
#exit 1
fi
}
stop() {
if [ -f $STEAM/$GAME/$NAME.pid ] && [ -f $STEAM/$GAME/$NAME-screen.pid ]; then
rm -f /var/lock/subsys/$NAME
echo "Stopping $TITLE - $LONGNAME."
# Get the process ID from the pid file we created earlier
for id in `cat $STEAM/$GAME/$NAME-screen.pid`
do kill -9 $id
echo "Killing process ID $id"
echo "Removing $TITLE screen pid file"
rm -rf $STEAM/$GAME/$NAME-screen.pid
break
done
# Remove server pid file
echo "Removing $TITLE pid file"
rm -rf $STEAM/$GAME/$NAME.pid
# Wipe all old screen sessions
screen -wipe 1> /dev/null 2> /dev/null
echo "$TITLE stopped."
else
echo -e "Cannot stop $TITLE. Server is not running."
#exit 1
fi
}
11-20-2008, 04:01 AM (This post was last modified: 11-20-2008, 04:06 AM by Goldendog.)
Thank you for the replies both. That is a nice check config file fox. I'll play with that once I get the server running. I'm using a guardian script I've placed into the Startup folder I enjoy as well.
Here's where I'm starting from for the L4D Server and what I'm trying to achieve:
I've got HLSupdatetool and am running a TF2 Server that I've installed and launch through CMD.
What I'm not quite sure about is how to download the dedicated server files needed for L4D and how I can point them to install to the HLServer folder. I can't remember the command I used to do this for TF2 nor the phrase I need to do it for L4D. Then I'm looking for the command to launch the server. I'll keep looking around the forums, but I'm having a hard time (as a SRCDS newbie) locating just the code I need out of all the posts discussing various commands.
to install the left 4 dead server files where you want. Then you point that init.d script to that location and fill in all the other vairables and hit /etc/init.d/l4d start (or if you have added it to chkconfig type service l4d start).
To manually start it you can again cd to the directory where you downloaded the left4dead files and run:
and that will start 4 left4dead servers. Make sure if you use fork + server_cfg##.cfg that you provide cfg for all your servers starting at 01. For a more basic setup just run this:
There is a bug with fork right now where if you do not supply a map it will not start, however if you use only 1 server, or do not use the fork switch you do not need to supply a map. Also since no ports are specified this will start on a possibly random port. Do
Code:
netstat -an
and search for the tcp connection associated with the ip you supplied in the start line.
When I run the "basic" server execution line listed above SRCDS actually opens up a GUI similar to what I'd see if I were launching the server through steam. It's a square green box complete with console tab. Is that normal?? With the TF2 server, it was ran entirely by the command prompt.
I suppose they work the same way. I've just never used one of those before. Since it's a GUI, can I remote admin it? The dedicated server box is of course located on a different connection than where I'll be gaming.
I want to do 2 servers, 1 Co-op & 1 Versus on my dedicated server, will I have to duplicate the game folder for each game type & work on the map cycle or is there a way to force a game type or map list?
I'm sure there's something to do with cfgs, I'm a bit confused now...
KrusT Wrote:Thanks for that Firefox005, great stuff!!
I want to do 2 servers, 1 Co-op & 1 Versus on my dedicated server, will I have to duplicate the game folder for each game type & work on the map cycle or is there a way to force a game type or map list?
I'm sure there's something to do with cfgs, I'm a bit confused now...
All you need to do s create two mapcycle files, one called mapcycle_vs.txt and the other called mapcycle_coop.txt and in the server_##.cfg of whichever server you want to be versus you add the line:
Firefox005 Wrote:All you need to do s create two mapcycle files, one called mapcycle_vs.txt and the other called mapcycle_coop.txt and in the server_##.cfg of whichever server you want to be versus you add the line:
Code:
mapcycle "mapcycle_vs.txt"
Inside the mapcycle_vs.txt add these two lines:
Code:
l4d_vs_farm01_hilltop
l4d_vs_hospital01_apartment
I did everything you said & I get this when server starts:
Unknown command "mapcycle"
This command should be in the server_***.cfg right?
11-25-2008, 08:11 AM (This post was last modified: 11-25-2008, 08:11 AM by KrusT.)
Thanks for those answers guys I'll try that.
Can someone give me an Start up command line for 2 servers (linux) please?
Can I start 2 servers using 1 line?