Page 1 of 1

[TOOL] Auto-Backup, Update, and Restart Batch File

Posted: Thu Jun 11, 2015 9:36 am
by FlyingMongoose
Tested to work with Windows Server 2008 R2 (this is Windows 7 of Windows Server)
  • This batch file will make sure your SavedArk directory is backed up to a separate directory.
  • It will make sure to run the potential update when it forces a restart.
  • It will launch your ARK Server and restart back at the first item I listed here.
INSTRUCTIONS:
Follow one of the many "Set up your server guides"
Copy this for your BATCH file and place it ANYWHERE
Change the paths as are applicable to you.
Remember: NO QUOTES OR SPACES BEFORE OR AFTER THE EQUAL SIGNS (if you do that you'll break it)

Code: Select all

@echo off

REM Server path sections
REM Set to ARK Server Path Root
SET ark_server_path=C:\Games\ark_server\
REM Set to SteamCMD Path Root
SET steamcmd_path=C:\Games\SteamCMD\
REM Set to where you want your SavedArks to back up to (NOT THE SAVEDARK DIRECTORY IT SELF!)
SET savedark_backup_path=C:\Games\SavedArkBackup

REM Server Settings Section
SET servername=CHANGETHIS
SET maximum_players=20
SET server_password=CHANGETHIS
SET admin_password=CHANGETHIS


REM DO NOT CHANGE BELOW THIS LINE!
SET query_port=27015
SET savedark_path=%ark_server_path%ShooterGame\Saved\SavedArks

:ARK
xcopy /f /s /v /z /i /-y /y %savedark_path% %savedark_backup_path%\%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%
cd %steamcmd_path%
steamcmd.exe +login anonymous +force_install_dir %ark_server_path% +app_update 376030 +quit
cd %ark_server_path%ShooterGame\Binaries\Win64
ShooterGameServer.exe TheIsland?QueryPort=27015?SessionName=%servername%?MaxPlayers=%maximum_players%?listen?ServerPassword=%server_password%?ServerAdminPassword=%admin_password% -nosteamclient -game -server -log
goto ARK

Re: [TOOL] Auto-Backup, Update, and Restart Batch File

Posted: Mon Jun 15, 2015 11:16 pm
by bruiser
thank you for the nice bat file.
just a couple questions. When I run the bat file it just loops the update part and doesn't ever start the server. Also, the backup never worked.
I don't see where it is shutting down the server. You mentioned a restart but is this just a start? not a restart?
Thanks for the help.
Bruiser

@echo off

REM Server path sections
REM Set to ARK Server Path Root
SET ark_server_path=C:\ARK\ark_server
REM Set to SteamCMD Path Root
SET steamcmd_path=C:\SteamCMD\
REM Set to where you want your SavedArks to back up to (NOT THE SAVEDARK DIRECTORY IT SELF!)
SET savedark_backup_path=C:\Ark-Backup

REM Server Settings Section
SET servername=Sager Gaming PVE
SET maximum_players=70
SET server_password=
SET admin_password=mypassword


REM DO NOT CHANGE BELOW THIS LINE!
SET query_port=27015
SET savedark_path=%ark_server_path%ShooterGame\Saved\SavedArks

:ARK
xcopy /f /s /v /z /i /-y /y %savedark_path% %savedark_backup_path%\%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%
cd %steamcmd_path%
steamcmd.exe +login anonymous +force_install_dir %ark_server_path% +app_update 376030 +quit
cd %ark_server_path%ShooterGame\Binaries\Win64
ShooterGameServer.exe TheIsland?QueryPort=27015?SessionName=%servername%?MaxPlayers=%maximum_players%?listen?ServerPassword=%server_password%?ServerAdminPassword=%admin_password% -nosteamclient -game -server -log
goto ARK

Re: [TOOL] Auto-Backup, Update, and Restart Batch File

Posted: Wed Jun 17, 2015 7:39 am
by FlyingMongoose
Sorry for delay in response (I do not frequent this forum yet), I'm working on an Open Source Qt/C++ Solution with a web panel interface, but this is the base of my functionality that I'll be implementing there. I'll post that later.

Basically as long as you're using a modern version of Windows (7 or newer), starting an application works closer to how it works in a Unix/Linux system. You can browse (using the CD command) to a folder, and just run the application from it's executable. The batch will then wait until that executable finishes running before moving to the next one. This is similar how Unix/Linux handles these kinds of things too (in a bash file there). At least it should.

It is a combination of a launcher, a patcher, and a backup utility.

The series is as I outlined above, I will re-iterate though. First of all make sure everything is set up in the variables properly (DO NOT PLACE SPACES OR QUOTES ANYWHERE BEFORE OR AFTER ANY EQUAL SIGN [this will break it]).

You should have the Ark Server installed (and probably at least one run independent of this so that the SavedArk folder gets created, xcopy [the copy utility included in Windows since XP] doesn't like trying to copy files that aren't there)

After you have done that and you run this batch file, it will look to see if you have the ArkSaved directory, copy that to your backup directory and put it in a date stamped folder there (no timestamps yet, that will come in my later project). It waits for completion then

Then it will run SteamCMD looking to update it.

When that is complete it will run the server (again, assuming settings are set properly).

Make note that my directory of C:\ark_server (for me) is the ROOT of the Ark server (not shootergame, the folder above that)

Since you say it seems to loop back to update and fail to load the server it makes me wonder if this is your proper root Ark server install directory:
C:\ARK\ark_server (this is what you have set).

Also for readability, please use the "code" tag around your copy paste of the batch file (just makes things easier)