Jump to content

Moving Files on Restarts Automatically Through Bat File


Friendly

Recommended Posts

With plenty of headaches on forgetting to switch pbos and having to keep track of each and every restart so that you can put your updates in I began getting frustrated and needed an alternative. My buddy and I finally setup a easy and simple bat file that moves our files for us on restarts incase we have to push updates like antihack, scripts, etc. Hope you guys find this as useful as we do :P

 

You might find the way we setup this up kinda weird but it is just how we prefer it so that folders appear at the top of our lists for neatness.

 

First we need you to create an @newFiles folder in the main directory of your arma server.

 

Next create an @newFiles folder in your @EpochHive folder where you see the addons folder located.

 

You also need to create an addons folder inside your @newFiles folder that you just put in the @EpochHive Folder so that you can organize which files are moving where.

 

In your MPMissions folder where your pbo's are located create a folder named newFiles in there as well so that you keep your edited mission files separate.

 

Now in your startup.bat or whatever you have named it paste the following code in your startup.bat, or whatever .bat file you use to start your server.

 
::Set the path to your servers main directory, usally your Arma 3 directory
set serverdir="D:\Arma 3\"
::=========================================================================================================================
::The name of the Hive path
set hive=@EpochHive
::=========================================================================================================================
::The name of the Map you are using/Name on your pbo Example: epoch.Altis.pbo Altis would be the name provided below
set hive=Altis
::=========================================================================================================================

::=========================================================================================================================
echo Coping over new files 
cd /d %serverdir%
move %hive%\newFiles\epochah.hpp %hive%
move %hive%\newFiles\epochconfig.hpp %hive%
move %hive%\newFiles\EpochServer.ini %hive%
move %hive%\newFiles\EpochServer.dll %hive%
move %hive%\newFiles\addons\*.* %hive%\addons
move @newFiles\run.sqf %serverdir%
move @newFiles\A3AH.sqf %serverdir%
move @newFiles\A3AT.sqf %serverdir%
move MPMissions\newFiles\epoch.%map%.pbo MPMissions
::=========================================================================================================================
 

The code above might need a few changes for you depending on what map you are using or folder names and I have made that easily editable.

 

Ok, here on is just to explain how this works.

It only moves the files that you define in the code above. It also only moves pbos and text files so you are allowed to have a folder in there and then pack the pbo and it will move that pbo out. I have it setup so that it will move anything that is located in the @EpochHive\newFiles\addons folder directly to @EpochHive/addons and it currently only moves the epochah.hpp/epochconfig.hpp/EpochServer.ini/EpochServer.dll in @EpochHive/newFiles to @EpochHive but you can add more files to that if needed. If you have anymore questions please just ask as it is hard to explain it all and I will add more to this post if needed.

Link to comment
Share on other sites

I incorporated something similar into the server restart batch.  It automatically updates files placed in a specified folder to the production server on a restart cycle.  It's a huge time saver and also helps make sure you don't copy the wrong files to the wrong place.  

 

@echo off
ping 127.0.0.1 -n 15 >NUL


::=====================================================================================================================================
:: close the running apps
::=====================================================================================================================================

taskkill /IM HCServer.exe /f /t
taskkill /IM arma3server.exe /f /t
::taskkill /IM ArmaServerMonitor.exe /f /t
taskkill /IM Bec.exe /f /t
::taskkill /IM networx.exe /f /t
::taskkill /IM redis-server.exe
ping 127.0.0.1 -n 5 >NUL

::=====================================================================================================================================
:: Backup and Delete Logs
::=====================================================================================================================================
:::::::::::::: CONFIG ::::::::::::::::::

:: Set your Arma3 Epoch Base installation directory. LEAVE OFF THE ENDING \
set arma3srvpath=C:\Game_Servers\Epoch_Bornholm

:: Set your Default server profile name. This is the name of the directory that stores your server.cfg
:: This will be used in the case that you don't launch this script without the server param.
:: Example: SC, US6, Chicago13, ect
:: DEFAULTPROFILE
set srvname=Bornholm
:: Delete Original log files after they have been rotated? This keeps your logs more organized and saves space.
:: This will not work unless the server is stopped first. This option works best set to 1 when using FireDaemon's Pre/Post Service tab
set deloriglogs=1

::::::::::: ADVANCED CONFIG ::::::::::::
:: Don't touch anything below this point unless you know what your doing.

:: Setting Server Profile to Use
IF "%1"=="" (
set servername=%srvname%
) else (
set servername=%1
)

TITLE  ArmaIII Epoch %servername% Server Log Rotater

:: Set Debug Mode
set debug=0
:: Set Debug Timeout in seconds
set dbsecs=10

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::  STOP EDITING ::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Display Debug output
if %debug% == 1 (
echo Server Name = %servername%
echo ArmaIII Server Path = "%arma3srvpath%"
timeout %dbsecs%
)

:: Set Time and Date
SET HOUR=%time:~0,2%
SET dtStamp9=%date:~-4%%date:~4,2%%date:~7,2%_0%time:~1,1%%time:~3,2%_%time:~6,2%
SET dtStamp24=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%_%time:~6,2%
::Make Date Stamp
if "%HOUR:~0,1%" == " " (SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%)
ECHO Todays Date and time (%date%)(%time%) / %dtStamp%
if %debug% == 1 (
timeout %dbsecs%
)

echo (%date%) (%time%) Starting Log Rotation.

:: Make the Rotated Log Directorys
if exist "%arma3srvpath%\%servername%\RotatedLogs" goto maketsdir
mkdir "%arma3srvpath%\%servername%\RotatedLogs"
:maketsdir
if exist "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%" goto makebedir
mkdir "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%"
:makebedir
if exist "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye" goto rotatelogs
mkdir "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye"

if exist "%arma3srvpath%\%servername%\RotatedLogs\DBbackups\%dtStamp%" goto rotatelogs
mkdir "%arma3srvpath%\%servername%\RotatedLogs\DBbackups\%dtStamp%"

:rotatelogs
:: Starting Log Rotation. If there are any other logs, just follow the format below, and make sure to NOT touch any of the variables.
copy "%arma3srvpath%\%servername%\BattlEye\scripts.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\scripts.log"
copy "%arma3srvpath%\%servername%\BattlEye\createvehicle.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\createvehicle.log"
copy "%arma3srvpath%\%servername%\BattlEye\deletevehicle.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\deletevehicle.log"
copy "%arma3srvpath%\%servername%\BattlEye\attachto.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\attachto.log"
copy "%arma3srvpath%\%servername%\BattlEye\publicvariable.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\publicvariable.log"
copy "%arma3srvpath%\%servername%\BattlEye\remoteexec.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\remoteexec.log"
copy "%arma3srvpath%\%servername%\BattlEye\selectplayer.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\selectplayer.log"
copy "%arma3srvpath%\%servername%\BattlEye\setpos.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\setpos.log"
copy "%arma3srvpath%\%servername%\BattlEye\setvariable.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\setvariable.log"
copy "%arma3srvpath%\%servername%\BattlEye\setdamage.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\setdamage.log"
copy "%arma3srvpath%\%servername%\BattlEye\addmagazinecargo.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\addmagazinecargo.log"
copy "%arma3srvpath%\%servername%\BattlEye\addbackpackcargo.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\addbackpackcargo.log"
copy "%arma3srvpath%\%servername%\BattlEye\addweaponcargo.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\addweaponcargo.log"
copy "%arma3srvpath%\%servername%\BattlEye\mpeventhandler.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\BattlEye\mpeventhandler.log"
::copy "%arma3srvpath%\dump.rdb" "%arma3srvpath%\DBbackups2\RotatedLogs\%dtStamp%\DBbackups\dump.rdb"
::copy "C:\Game_Servers\REDIS\Bornholm\dump.rdb" "%arma3srvpath%\%servername%\RotatedLogs\DBbackups\%dtStamp%\dump.rdb"
copy "%arma3srvpath%\%servername%\A3Master_*.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\A3Master_*.log"
copy "%arma3srvpath%\%servername%\arma3server_*.rpt" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\arma3server_*.rpt"
copy "%arma3srvpath%\a3_adminlog*.txt" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\a3_adminlog.txt"
copy "%arma3srvpath%\a3_hacklog*.txt" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\a3_hacklog.txt"
copy "%arma3srvpath%\a3_surveillancelog*.txt" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\a3_surveillancelog.txt"
copy "%arma3srvpath%\malloc_*.log" "%arma3srvpath%\%servername%\RotatedLogs\%dtStamp%\malloc_*.log"

echo (%date%) (%time%) Logs are backed up now...
echo (%date%) (%time%) Removing original log files.
del /Q /F "%arma3srvpath%\%servername%\BattlEye\scripts.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\createvehicle.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\attachto.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\deletevehicle.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\selectplayer.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\publicvariable.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\remoteexec.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\setpos.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\setvariable.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\addmagazinecargo.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\addbackpackcargo.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\addweaponcargo.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\mpeventhandler.log"
del /Q /F "%arma3srvpath%\%servername%\BattlEye\setdamage.log"
del /Q /F "%arma3srvpath%\%servername%\A3Master_*.log"
del /Q /F "%arma3srvpath%\%servername%\arma3server_*.rpt"
del /Q /F "%arma3srvpath%\a3_adminlog*.txt"
del /Q /F "%arma3srvpath%\a3_hacklog*.txt"
del /Q /F "%arma3srvpath%\a3_surveillancelog*.txt"
del /Q /F "%arma3srvpath%\malloc_*.log"

if %debug% == 1 (
timeout %dbsecs%
)

:: Done


::=====================================================================================================================================
::Copy updates to live folders before restarting server
::=====================================================================================================================================


xcopy "C:\Game_Servers\Updates\a3_epoch_server.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_epoch_server.pbo" /Y
xcopy "C:\Game_Servers\Updates\EpochServer.dll" "C:\Game_Servers\Epoch_Bornholm\@epochhive\EpochServer.dll" /Y
::xcopy "C:\Game_Servers\Updates\BEServer.dll" "C:\Game_Servers\Epoch_Bornholm\Bornholm\BattlEye\BEServer.dll" /Y
::xcopy "C:\Game_Servers\Updates\a3_epoch_server_building.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_epoch_server_building.pbo" /Y
xcopy "C:\Game_Servers\Updates\a3_epoch_server_settings.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_epoch_server_settings.pbo" /Y
::xcopy "C:\Game_Servers\Updates\a3_epoch_server_custom.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_epoch_server_custom.pbo" /Y
xcopy "C:\Game_Servers\Updates\indestructible_buildings.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\indestructible_buildings.pbo" /Y
xcopy "C:\Game_Servers\Updates\FuMS.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\FuMS.pbo" /Y
xcopy "C:\Game_Servers\Updates\loot_addon.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\loot_addon.pbo" /Y
::xcopy "C:\Game_Servers\Updates\a3_epoch_addons.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_epoch_addons.pbo" /Y
::xcopy "C:\Game_Servers\Updates\a3_epoch_fixBornholm.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_epoch_fixBornholm.pbo" /Y
xcopy "C:\Game_Servers\Updates\a3_sdrop.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_sdrop.pbo" /Y
xcopy "C:\Game_Servers\Updates\a3_custom.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\a3_custom.pbo" /Y
xcopy "C:\Game_Servers\Updates\A3EAI_config.sqf" "C:\Game_Servers\Epoch_Bornholm\@epochhive\A3EAI_config.sqf" /Y
xcopy "C:\Game_Servers\Updates\A3EAI_custom_defs.sqf" "C:\Game_Servers\Epoch_Bornholm\@epochhive\A3EAI_custom_defs.sqf" /Y
xcopy "C:\Game_Servers\Updates\A3EAI.pbo" "C:\Game_Servers\Epoch_Bornholm\@epochhive\addons\A3EAI.pbo" /Y
xcopy "C:\Game_Servers\Updates\A3AH.sqf" "C:\Game_Servers\Epoch_Bornholm\A3AH.sqf" /Y
xcopy "C:\Game_Servers\Updates\A3AT.sqf" "C:\Game_Servers\Epoch_Bornholm\A3AT.sqf" /Y
xcopy "C:\Game_Servers\Updates\run.sqf" "C:\Game_Servers\Epoch_Bornholm\run.sqf" /Y
::xcopy "C:\Game_Servers\Updates\infiSTARwriteBan.DLL" "C:\Game_Servers\Epoch_Bornholm\infiSTARwriteBan.DLL" /Y
xcopy "C:\Game_Servers\Updates\config.cfg" "C:\Game_Servers\Epoch_Bornholm\Bornholm\config.cfg" /Y
xcopy "C:\Game_Servers\Updates\basic.cfg" "C:\Game_Servers\Epoch_Bornholm\Bornholm\basic.cfg" /Y
xcopy "C:\Game_Servers\Updates\DeAtHhOuSe_epoch.Bornholm.pbo" "C:\Game_Servers\Epoch_Bornholm\MPMissions\DeAtHhOuSe_epoch.Bornholm.pbo" /Y
::xcopy "C:\Game_Servers\Updates\epoch.Altis.pbo" "C:\Users\Richard\AppData\Local\Arma 3\MPMissionsCache\epoch.Altis.pbo" /Y
xcopy "C:\Game_Servers\Updates\epochah.hpp" "C:\Game_Servers\Epoch_Bornholm\@epochhive\epochah.hpp" /Y
xcopy "C:\Game_Servers\Updates\epochconfig.hpp" "C:\Game_Servers\Epoch_Bornholm\@epochhive\epochconfig.hpp" /Y
xcopy "C:\Game_Servers\Updates\basic.cfg" "C:\Game_Servers\Epoch_Bornholm\Bornholm\basic.cfg" /Y
::xcopy "C:\Game_Servers\Updates\BEFilters\*.*" "C:\Game_Servers\Epoch_Bornholm\Bornholm\Battleye\" /Y



::=====================================================================================================================================
::Start ASM
::=====================================================================================================================================

::cd "C:\Game_Servers\Epoch_Bornholm\"
::start "ASM" C:\Game_Servers\Epoch_Bornholm\ArmaServerMonitor.exe


::=====================================================================================================================================
:: start the server
::=====================================================================================================================================

cd "C:\Game_Servers\Epoch_Bornholm\"
start "arma3server" "arma3server.exe" -mod=@ASM;@Bornholm13;@Epoch;@EpochHive; -profiles=Bornholm -name=Bornholm -port=2340 -config=C:\Game_Servers\Epoch_bornholm\bornholm\config.cfg -cfg=C:\Game_Servers\Epoch_bornholm\bornholm\basic.cfg -loadMissionToMemory -malloc=system -high -nosplash -nopause -noSound -autoinit -enableHT


::=====================================================================================================================================
:: start BEC
::=====================================================================================================================================

cd "C:\BEC\"
start Bec.exe -f Arma_3_Epoch_Bornholm_Config.cfg


::=====================================================================================================================================
:: wait for server to start
::=====================================================================================================================================

ping 127.0.0.1 -n 15 >NUL



::=====================================================================================================================================
:: start headless client
::=====================================================================================================================================

cd "C:\Game_Servers\Epoch_Bornholm\"
start "arma3serverHC" "HCServer.exe" -client -connect=127.0.0.1 -port=2340 -mod=@A3EAI;@Epoch;@Bornholm13; -nosound -high -enableHT



::  All Done!!

exit

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
  • Advertisement
  • Discord

×
×
  • Create New...