Custom Command Line Batch Files for Starting a Server

weakness_aaweakness_aa Posts: 144Player
edited February 2016 in Server Support
Any one out there using custom batch files to start and stop their server care to share their batch files? I'm looking to improve mine. I'm looking for better versions than the ones I created.

Comments

  • iNv|eKCommiNv|eKComm Posts: 394Player
    I'm using this to start currently. My intention is to hook it up to NSSM to make it run as a service. Then the Stop function would be as simple as calling NSSM to close the service name i started it as. Haven't set that up yet though.

    @echo off

    echo "Starting server.."

    echo "Checking version.."

    steamcmd +login anonymous +force_install_dir c:\AAPGServer +app_update 203290 +quit

    echo "Version is up to date."

    echo "Enabling Punkbuster.."

    cd "C:\AAPGServer\AAPG\Binaries\pbinstall\win32"
    break > pbsvgame.cfg
    echo sv_punkbuster 1 >> pbsvgame.cfg

    cd "C:\AAPGServer\AAPG\Binaries\Win32\pb"
    break > pbsvgame.cfg
    echo sv_punkbuster 1 >> pbsvgame.cfg

    echo "Punkbuster enabled."

    echo "Setting INIs."

    cd "C:\AAPGServer"
    AAPGiniTool.exe iNvNYConfig.txt

    echo "Starting AA:PG server.."

    "C:\AAPGServer\AAPG\Binaries\Win32\AAGame.exe" server BDX_Checkout_EX /GLOBAL /AuthServerUserName=**** /AuthServerPassword=**** /AuthServerIP=192.223.24.181 /STEAMSERVERIP=192.223.24.181 MULTIHOME=192.223.24.181 /NOPAUSE /NOHOMEDIR /CONFIGSUBDIR=iNvadersNY /SGSP=7778 /INST=1

    exit
    2016 Flank Gaming Network Season 1 Champion
    2016 FraggedNation Season 4 Champion
    2015 FraggedNation Season 2 Main Champion
    2015 ESL Test Cup Second place
    2014 FraggedNation UMM Tournament Champion
    2014 FraggedNation Old School map Tournament Champion
    2014 TWL Season 1 Second Place
    2013 TWL 7v7 Beta Tournament Champion
    2013 TWL 5v5 Beta Tournament Second Place
  • weakness_aaweakness_aa Posts: 144Player
    edited February 2016
    I'm looking for a full script style like this below. I don't do any error checking here. I'm hoping to improve what I have for a stand-alone server....

    ECHO OFF
    set map=""
    :MAPLIST
    CLS
    ECHO.
    ECHO ...............................................
    ECHO Please Select your FLO Style Map to Start
    ECHO ...............................................
    ECHO.
    ECHO 1 - FLO_Bridge_EX
    ECHO 2 - FLO_BridgeNight_EX
    ECHO 3 - FLO_Checkout_EX
    ECHO 4 - FLO_ColdFront_C4
    ECHO 5 - FLO_ColdFront_EX
    ECHO 6 - FLO_Downtown_EX
    ECHO 7 - FLO_HarborAssault_TH
    ECHO 8 - FLO_HarborAssaultNight_TH
    ECHO 9 - FLO_InnerHospital_EX
    ECHO 10 - FLO_Intercept_C4
    ECHO 11 - FLO_Intercept_EX
    ECHO 12 - FLO_Overload_C4
    ECHO 13 - FLO_RedLine_C4
    ECHO 14 - FLO_RedLine_EX
    ECHO 15 - FLO_Slums_C4
    ECHO 16 - FLO_Slums_TH
    ECHO 17 - FLO_Watchdog_AC
    ECHO 18 - FLO_Watchdog_C4
    ECHO.
    SET /P MAP=Type MAP Number then press ENTER:

    IF %MAP%==1 (
    set MAP=FLO_Bridge_EX
    ) ELSE (

    IF %MAP%==2 (
    set MAP=FLO_BridgeNight_EX
    ) ELSE (

    IF %MAP%==3 (
    set MAP=FLO_Checkout_EX
    ) ELSE (

    IF %MAP%==4 (
    set MAP=FLO_ColdFront_C4
    ) ELSE (

    IF %MAP%==5 (
    set MAP=FLO_ColdFront_EX
    ) ELSE (

    IF %MAP%==6 (
    set MAP=FLO_Downtown_EX
    ) ELSE (

    IF %MAP%==7 (
    set MAP=FLO_HarborAssault_TH
    ) ELSE (

    IF %MAP%==8 (
    set MAP=FLO_HarborAssaultNight_TH
    ) ELSE (

    IF %MAP%==9 (
    set MAP=FLO_InnerHospital_EX
    ) ELSE (

    IF %MAP%==10 (
    set MAP=FLO_Intercept_C4
    ) ELSE (

    IF %MAP%==11 (
    set MAP=FLO_Intercept_EX
    ) ELSE (

    IF %MAP%==12 (
    set MAP=FLO_Overload_C4
    ) ELSE (

    IF %MAP%==13 (
    set MAP=FLO_RedLine_C4
    ) ELSE (

    IF %MAP%==14 (
    set MAP=FLO_RedLine_EX
    ) ELSE (

    IF %MAP%==15 (
    set MAP=FLO_Slums_C4
    ) ELSE (

    IF %MAP%==16 (
    set MAP=FLO_Slums_TH
    ) ELSE (

    IF %MAP%==17 (
    set MAP=FLO_Watchdog_AC
    ) ELSE (

    IF %MAP%==18 (
    set MAP=FLO_Watchdog_C4

    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )
    )

    GOTO START

    :START
    cd "C:\Program Files (x86)\Steam\steamapps\common\America's Army\AAPG\Binaries\Win32"
    start AAGame.exe server %MAP% /GLOBAL /AuthServerUserName=******* /AuthServerPassword=*********** /AuthServerIP=X.X.X.X /STEAMSERVERIP=X.X.X.X MULTIHOME=X.X.X.X /NOPAUSE /NOHOMEDIR /CONFIGSUBDIR=AAHostAServerConfig0 /SAP=7780 /SGSP=7778 /SQP=27015 /INST=1
    GOTO END

    :END
  • iNv|eKCommiNv|eKComm Posts: 394Player
    You can do some file modification in your script. I was never a fan of doing that via scripting. Instead i wrote an executable that handles all the ini modification.

    If you look closely in my script you'll see this line. Does all the work for me.
    AAPGiniTool.exe iNvNYConfig.txt

    I intend to release it to the public when its ready. Still doing some work and testing.
    2016 Flank Gaming Network Season 1 Champion
    2016 FraggedNation Season 4 Champion
    2015 FraggedNation Season 2 Main Champion
    2015 ESL Test Cup Second place
    2014 FraggedNation UMM Tournament Champion
    2014 FraggedNation Old School map Tournament Champion
    2014 TWL Season 1 Second Place
    2013 TWL 7v7 Beta Tournament Champion
    2013 TWL 5v5 Beta Tournament Second Place
  • Keebler750Keebler750 Posts: 3,605Beta Tester
    Very cool!

    I'm dying for someone to do a full blown GUI tool like the old server manager "AASM." We really need it!

    :)
    ______

    This has been a test of the emergency flame-fest system. Please do not adjust your set.
  • weakness_aaweakness_aa Posts: 144Player
    You can do some file modification in your script. I was never a fan of doing that via scripting. Instead i wrote an executable that handles all the ini modification.

    If you look closely in my script you'll see this line. Does all the work for me.
    AAPGiniTool.exe iNvNYConfig.txt

    I intend to release it to the public when its ready. Still doing some work and testing.

    If they ever release a Linux Server build, a custom script to launch a SCREEN Console will be a must. I'd rather use a .bat or .cmd file in windows so that I don't have to trouble shoot an executable launcher or file. By giving the user an input variable, the map choices are easy. It also allows for launching multiple servers with separate batch files. How well does your " AAPGiniTool.exe " work when launched multiple times? Can it distinguish different server instances? What is it's memory footprint?

  • iNv|eKCommiNv|eKComm Posts: 394Player
    edited February 2016
    The memory consumption is worst case the size of the largest ini file you want to parse. So basically, nothing. Time complexity is worst case (Lines in datafile * lines in largest ini). I could probably make it run faster but right now it runs in milliseconds anyway so my gains for writing a slightly more efficient traversal mechanism would be minimal.

    You can run as many instances of it as you want simultaneously and it distinguishes based on config path.

    In a couple weeks you may be able to try it for yourself! I just want to do my due diligence on the unit testing.
    2016 Flank Gaming Network Season 1 Champion
    2016 FraggedNation Season 4 Champion
    2015 FraggedNation Season 2 Main Champion
    2015 ESL Test Cup Second place
    2014 FraggedNation UMM Tournament Champion
    2014 FraggedNation Old School map Tournament Champion
    2014 TWL Season 1 Second Place
    2013 TWL 7v7 Beta Tournament Champion
    2013 TWL 5v5 Beta Tournament Second Place
Sign In or Register to comment.