Jump to content

Simple ark self hosted dedicated server (windows 11) start script


ServerWolf
 Share

Recommended Posts

Hi, I've been struggling a lot with my self hosted ASA servers, but I think I finally mostly fixed it and it is now working well for me.

Here is the start script, only need to change the parts with <insert blabla> for your server specifics for it to use.

Startserver.bat

:: 		Thing I found to remove script asking to terminate
rem Bypass "Terminate Batch Job" prompt.
if "%~1"=="-FIXED_CTRL_C" (
   REM Remove the -FIXED_CTRL_C parameter
   SHIFT
) ELSE (
   REM Run the batch with <NUL and -FIXED_CTRL_C
   CALL <NUL %0 -FIXED_CTRL_C %*
   GOTO :EOF
)
:: 
set ServerPath=C:\<insert server path>\server1
set SteamPath=C:\<insert server path>\SteamCMD\steamcmd.exe
::  	commented out cluster settings, don't seem to work yet in Ascended
set "Cluster= "
::  	set Cluster=-NoTransferFromFiltering -ClusterDirOverride=C:\<insert server path>\cluster -ClusterID=<insert clusterID>
::  	Not sure if I needed to set the cluster variable with an empty value, but didn't bother to check without next line.
set "ServerName=<insert server name>"
set MapName=TheIsland_WP
::  	Sets alternate savepath for server instead of SavedArks
set AltPath=SaveServer1
set MaxPlayers=100
:: 		Server password somehow it doesnt work for me without the quotations.
set "ServerPassword=<insert server password>"
:: 		Admin password somehow it doesnt work for me with quotations? So weird.
set AdminPassword=<insert admin password>
::		Again for ports I need to use these quotations for them to work. I don't understand why.
set "Port=<insert gameport>"
:: 		Commented out queryport, ASA doesn't seem to use query port at all.
set "QueryPort= "
::  	set "QueryPort= ?QueryPort=<insert queryport>
set "RconPort=<insert rconport>"
set ModList=<insert mod list, example: set ModList=900062,926956>
set AdditionalSettings=-WinLiveMaxPlayers=%MaxPlayers% -SecureSendArKPayload -ActiveEvent=none -UseBattlEye -servergamelog -game -server -log -mods=%ModList% %Cluster%
set executable=ArkAscendedServer.exe

cls
@echo off
title %ServerName% Watchdog                                                                                                                                                                  
echo DO NOT CLOSE THIS WINDOW!
echo.
:start
tasklist /nh /fi "Imagename eq %executable%" | find "ArkServer"
if ERRORLEVEL=1 goto update
if ERRORLEVEL=0 goto close
:update
echo Checking For Update
start "" /b /w /high "%SteamPath%" +force_install_dir %ServerPath% +login anonymous +app_update 2430930 validate +quit
echo.
echo If No Errors Exist, %ServerName% Has Been Started! Check Task Manager
echo.
echo Waiting For Crash...
::  Again, I need to somehow use escaped quotations here on the servername for it to work for me. Not sure why.
start "" /w /high "%serverpath%\ShooterGame\Binaries\Win64\%executable%" %MapName%?listen?ServerPassword=%ServerPassword%?AltSaveDirectoryName=%AltPath%?SessionName=\"%ServerName%\" ?Port=%Port%%QueryPort%?RconPort=%RconPort% ?ServerAdminPassword=%AdminPassword% %AdditionalSettings% exit
echo Crash Detected!
echo.
echo CTRL+C To Freeze Before Restarting
timeout /t 5
goto start
:close
echo.
echo !ERROR! SERVER ALREADY RUNNING! SHUTDOWN WILL COMMENCE
taskkill /im "%executable%" /f /t
timeout /t 3
goto start

Backupservers.bat

timeout /t 10 /nobreak >nul
@echo off
set ServerDir=C:\<insert server path>\asaservers
set Server1Folder=server1
::  server 2 commented out, but if you want to run multiple servers and back them all up, this is how
::  set Server2Folder=server2
set Alt1Dir=SaveServer1
::  set Alt2Dir=SaveServer2
set BackUpDir=D:\<insert backup path>\asabackup
::  how long to keep old backups in the backup folder
set DelDays=7
::  just need to put a txt file named C:\<insert server path>\asaservers\scripts\exclude.txt with 4 lines: 
:: _WP_0
:: _WP_1
:: _WP_2
:: _WP_3 
:: This is so the backup ignores the standard ark backup files, saves some disk space.
:: 
:: This is the folder I save both of these scripts. In this file it is only used to find the exlude.txt as above.
set ScriptDir=C:\<insert server path>\asaservers\scripts
set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
set year=%date:~-4%
set month=%date:~3,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%
set day=%date:~0,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%
set datetimef=%year%%month%%day%_%hour%%min%%secs%
:: server 1
xcopy /s "%ServerDir%\%Server1Folder%\ShooterGame\Saved\%Alt1Dir%" "%BackUpDir%\%Server1Folder%\%datetimef%\Saved\%Alt1Dir%" /c /d /e /h /i /r /y /exclude:%ExcludeDir%\exclude.txt
xcopy /s "%ServerDir%\%Server1Folder%\ShooterGame\Saved\SaveGames" "%BackUpDir%\%Server1Folder%\%datetimef%\Saved\SaveGames" /c /d /e /h /i /r /y
:: server 2
:: xcopy /s "%ServerDir%\%Server2Folder%\ShooterGame\Saved\%Alt2Dir%" "%BackUpDir%\%Server2Folder%\%datetimef%\Saved\%Alt2Dir%" /c /d /e /h /i /r /y /exclude:%ExcludeDir%\exclude.txt
:: xcopy /s "%ServerDir%\%Server2Folder%\ShooterGame\Saved\SaveGames" "%BackUpDir%\%Server2Folder%\%datetimef%\Saved\SaveGames" /c /d /e /h /i /r /y
echo on
:: server 1
:: Obviously need to dl 7-zip for this to work. If you dont use this, also remove the lines below that remove old files. Then the backup will just be saved as a folder.
"C:\Program Files\7-Zip\7z.exe" a -tzip "%BackUpDir%\%Server1Folder%\%Server1Folder%%datetimef%.7z" "%BackUpDir%\%Server1Folder%\%datetimef%\Saved"
:: server 2
:: "C:\Program Files\7-Zip\7z.exe" a -tzip "%BackUpDir%\%Server2Folder%\%Server2Folder%%datetimef%.7z" "%BackUpDir%\%Server2Folder%\%datetimef%\Saved"
:: Removes copied folder
@RD /S /Q "%BackUpDir%\%Server1Folder%\%datetimef%"
:: Removes files older than DelDays
forfiles /p "%BackUpDir%\%Server1Folder%" /s /m *.* /d -%DelDays% /c "cmd /c del @path"
:: @RD /S /Q "%BackUpDir%\%Server2Folder%\%datetimef%"
:: forfiles /p "%BackUpDir%\%Server2Folder%" /s /m *.* /d -%DelDays% /c "cmd /c del @path"

This I learned. -automanagedmods does nothing/not needed.
Queryport not needed, isn't used anymore. Server queries on game port.

Open gameport  as UDP

Open rcon as TCP

Enable rules for firewall for the same ports.

If rcon ask for a queryport, use gameport.

PS: For some reason I need to use quotations on some batch variables, but not on others. And I need to encase the server name variable in escaped quotations in the commandline. I don't fully understand why, but it wasn't working for me without these changes...

 

Maybe this will help those looking to self host on windows for Ark Ascended.

Edited by ServerWolf
  • Thanks 1
Link to comment
Share on other sites

Decent chunk of code, the "" prob is part of syntax or something. You can notice it at other programming languages, updates to c++ and unreal or something. 

If i rembr right it should be making data into text or taking data within and doing something with it.

ex.

int a = 20;

      if (a  >  5) {

        print ("Hello World!");

}

 

hmm not sure if the "IF" statement is the greatest in this application. Since the executable will keep checking the if condition if its true or not in a loop or until the exe is broken. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...