On a dedicated server for Source engine games, there are two "global" configuration files - server.cfg and autoexec.cfg. Are these files executed at different times? What sort of configurations should go in which file?
2 Answers
autoexec.cfg is automatically executed once when the server starts before a map loads
server.cfg is automatically executed each time a map loads, including map changes
There's also map specific configs that are named after the map. These are executed last.
You usually want to put all of your server configuration in server.cfg
so that any setting changes, such as from a mapname.cfg
file, are reset when the map changes. The autoexec.cfg
is used for anything that should be done before a map loads, such as sv_pure
settings.
Also, you can change which file is executed on map change using the servercfgfile
cvar. This is handy if you want to have different modes on a server, or run multiple servers from the same installation.
-
Not true, see developer.valvesoftware.com/wiki/Server.cfg and developer.valvesoftware.com/wiki/Autoexec, they're executed at launch.– user56Commented Jul 20, 2010 at 7:33
-
Which part of my answer is not true? Autoexec.cfg executes once at launch and server.cfg, by default, executes on every map change. That's the way it works. Commented Jul 20, 2010 at 17:37
-
The part where you say that server.cfg, by default, executes on every map change. According to Valve, it doesn't.– user56Commented Mar 9, 2011 at 17:29
While it might work for servers, autoexec.cfg
is meant for clients. server.cfg
only works on the server-side, which is useful since it will only be run if you launch a server (eg a listen server) not when you just join one. autoexec.cfg
will fire in both cases.
-
Will autoexec.cfg fire on mapchange, on joining a server, or only when initially launching the game?– JeffreyCommented Jul 19, 2010 at 14:11
-
On launch only. Same goes for server.cfg, but only if run as a dedicated server.– user56Commented Jul 19, 2010 at 14:18
-
1You can manually run autoexec.cfg using 'exec autoexec.cfg' in the Developer console.– cowgodCommented Jul 20, 2010 at 3:51