Jump to content
Sign in to follow this  
oktane

Helpful batch file for dedicated servers

Recommended Posts

Here is a handy batch file for starting the dedicated.. I use it with http://www.nick.rozanski.org.uk/index.php?page=software#srvstart for keeping the server running even after it crashes constantly. wink_o.gif It keeps good logs and rotates them so they never get too big. Hope this is helpful to someone.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

:: Arma server and logging helper - by oktane + some parts BIS wiki

:: Please create a 'Profiles' and 'Logs' directory inside of your arma folder before running.

:: Note: Logs only get copied when server is run again, use a service to automatically restart this file

:: exename of this server instance (NO .exe) (ex: arma_server or arma_server2302 if you renamed it for taskmgr)

set _exename=arma_server

:: root drive of game servers directory - (NO TRAILING BACKSLASH) (ex: d:)

set _drive=D:

:: root servers directory (not arma directory!) (MUST HAVE TRAILING BACKSLASH) (ex: servers\)

:: if you dont have a d:\servers\armainstall1, armainstall2, armainstall3, you can leave it blank.

set _serversdir=servers\

:: arma directory name of this server instance, name only - (NO BACKSLASHES) (ex: ArmaPublic or Arma)

set _dirname=ArmaPublic

:: port this server instance runs on (ex: 2302)

set _port=2302

:: profile name that the server should use for difficulty settings (located in _serverdirname\_dirname\Profiles\Users)

:: if the profile does not exist, arma will create it with default settings.

set _profilename=server

:: mods you want the server to run (ex: @DurgsVegFix;@EVH)

:: WARNING this cannot be blank, if you dont have mods, see the end of the file.

set _mods=@Required;@ECS;@DurgsVegetationFix;@mod1;@mod2;@mod3

:: END OF CONFIGURATION -------------------------------------------------------------------------------

:: kill it if its running (if you run multiple servers on same machine, use different EXE names!)

taskkill /f /im %_exename%.exe

:: change drive and go to directory

%_drive%

cd \%_serversdir%%_dirname%

for /F "tokens=1-3,5-8 delims=/:. " %%a in ("%TIME% %DATE%") do (set _dt=%%g%%e%%f%%d-%%a%%b%%c)

move net.log ".\Logs\%_dt%_net.log"

move .\profiles\%_exename%.RPT ".\Logs\%_dt%_%_exename%.RPT"

move .\profiles\%_exename%.bidmp ".\Logs\%_dt%_%_exename%.bidmp"

move .\profiles\%_exename%.mdmp ".\Logs\%_dt%_%_exename%.mdmp"

move .\profiles\server_console.log ".\Logs\%_dt%_server_console.log"

:: Run the server.. only choose one line. You can add any other switches you want, like -netlog

:: uncomment below for normal operation

"%_drive%\%_serversdir%%_dirname%\%_exename%.exe" -port=%_port% -cfg=basic.cfg -config=server.cfg -name=%_profilename% -profiles=%_drive%\%_serversdir%%_dirname%\Profiles\ -mod=%_mods%

:: uncomment below for normal operation with NO MODS

::"%_drive%\%_serversdir%%_dirname%\%_exename%.exe" -port=%_port% -cfg=basic.cfg -config=server.cfg -name=%_profilename% -profiles=%_drive%\%_serversdir%%_dirname%\Profiles\

:: uncomment below for testing.. virgin with no mods, no basic.cfg and empty test profile

::"%_drive%\%_serversdir%%_dirname%\%_exename%.exe" -port=%_port% -config=server.cfg -name=test -profiles=%_drive%\%_serversdir%%_dirname%\Profiles\

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×