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?


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.

|improve this answer|||||
  • Not true, see developer.valvesoftware.com/wiki/Server.cfg and developer.valvesoftware.com/wiki/Autoexec, they're executed at launch. – user56 Jul 20 '10 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. – Steve Guidetti Jul 20 '10 at 17:37
  • The part where you say that server.cfg, by default, executes on every map change. According to Valve, it doesn't. – user56 Mar 9 '11 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.

|improve this answer|||||
  • Will autoexec.cfg fire on mapchange, on joining a server, or only when initially launching the game? – Jeffrey Jul 19 '10 at 14:11
  • On launch only. Same goes for server.cfg, but only if run as a dedicated server. – user56 Jul 19 '10 at 14:18
  • 1
    You can manually run autoexec.cfg using 'exec autoexec.cfg' in the Developer console. – cowgod Jul 20 '10 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.