Last active
September 17, 2023 15:38
-
-
Save robinrm/7fb2e1981b65eedc2f5aab70a7368ca9 to your computer and use it in GitHub Desktop.
Minecraft 1.19.2 Modded Server Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:initial_Section | |
::var defaults | |
set debugmode=0 | |
::0 = Normally | |
::1 = Normally + Debug Skip Intro | |
::2 = Normally + Backup Debug Skip Intro | |
::3 = Only Backup Normally | |
::4 = Only Backup + Debug Skip Intro | |
::5 = Backup + delete old date file | |
set heartbeat=1 | |
::important for Backup Script working properly | |
set single_backup=0 | |
::backup called once (no 5 min timer) for backup after server closed | |
::UI | |
set title=Minecraft Server | |
set cmd_width=101 | |
set cmd_height=20 | |
set server_width=175 | |
set server_height=10 | |
set color_red=04 | |
set color_orange=06 | |
set color_green=0a | |
::server name + location | |
set Version="MC 1.19.2 modded" | |
set install="C:\_server\%version:~1,-1%" | |
set logs="C:\_logs\%version:~1,-1%" | |
::backup location | |
set Backup_Stored_IN="C:\Users\Administrator\OneDrive - Eickelmann & Meyer Industries GbR\Share\Backups\Input\%version:~1,-1%" | |
set Backup_Stored_OUT="C:\Users\Administrator\OneDrive - Eickelmann & Meyer Industries GbR\Share\Backups\Output\%version:~1,-1%" | |
::caller | |
set Backup_Caller="C:\_bat\Backups\Minecraft Backup.bat" | |
set ldt_generator="C:\_bat\ldt.bat" | |
set ldt_generator_name="Administrator: Local Date Time Generator" | |
::set ldt= | |
::set PID= | |
set winrar="C:\Windows\rar.exe" | |
::server template location | |
set templates="C:\_templates" | |
set special_templates="%templates:~1,-1%\Minecraft" | |
::lowerCase converter (oneliner) | |
set LowerCase=for /L %%a in (1 1 2) do if %%a==2 (for %%# in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do set "converted=!converted:%%#=%%#!") else setlocal enableDelayedExpansion ^& set converted= | |
::set converted= | |
::var server special | |
::server config | |
set config="%install:~1,-1%\server.properties" | |
::savefolder | |
set save="%install:~1,-1%\savegame" | |
::file to check for changes | |
set backup="%install:~1,-1%\backups\*.zip" | |
::Ports UDP 25565 TCP 25565, 25575 | |
set Port=25565 | |
set IP=109.230.253.25 | |
::JAVA | |
set java_path="C:\Program Files\Java\jdk-17\bin\java.exe" | |
set java_RAM=32G | |
::Forge Installer | |
set mc_version=1.19.2 | |
set forge_version=43.2.3 | |
set forge_url="https://files.minecraftforge.net/maven/net/minecraftforge/forge/%mc_version%-%forge_version%/forge-%mc_version%-%forge_version%-installer.jar" | |
set forge_installer="%install:~1,-1%\forge-%mc_version%-%forge_version%-installer.jar" | |
::config file options | |
set players=222 | |
set pvp=false | |
set rcon_on=false | |
set rcon_port=25575 | |
set rcon_pw=password | |
set seed=-7216591772998811596 | |
set spawn_protect=0 | |
set view_distance=10 | |
set whitelist=false | |
:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
:: var init done | |
::check for debugmode | |
if %debugmode% equ 0 ( | |
powershell Write-Host "started - Normally" -ForegroundColor Magenta | |
echo/ | |
timeout /T 3 /NOBREAK >nul | |
goto normal_start | |
) | |
if %debugmode% equ 1 ( | |
powershell Write-Host "started - Debugmode" -ForegroundColor Magenta | |
echo/ | |
timeout /T 3 /NOBREAK >nul | |
goto normal_start | |
) | |
if %debugmode% equ 2 ( | |
powershell Write-Host "started - Normally - Backup in Debugmode" -ForegroundColor Magenta | |
echo/ | |
timeout /T 3 /NOBREAK >nul | |
goto normal_start | |
) | |
if %debugmode% equ 3 ( | |
powershell Write-Host "started only Backup - Normally" -ForegroundColor Magenta | |
echo/ | |
goto debugmode_start | |
goto normal_start | |
) | |
if %debugmode% equ 4 ( | |
powershell Write-Host "started only Backup - Debug" -ForegroundColor Magenta | |
echo/ | |
goto debugmode_start | |
) | |
if %debugmode% equ 5 ( | |
powershell Write-Host "started only Backup - delete old date file first" -ForegroundColor Magenta | |
echo/ | |
goto debugmode_start | |
) else ( | |
::no Backup only mode active | |
powershell Write-Host "No Mode selected" -ForegroundColor Red | |
echo/ | |
pause /NOBREAK >nul | |
exit | |
) | |
:debugmode_start | |
start "" "%Backup_Caller:~1,-1%" | |
timeout /T 5 /NOBREAK >nul | |
exit | |
:normal_start | |
::set UI Information | |
mode con lines=%cmd_height% cols=%cmd_width% | |
powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%cmd_width%;$B.height=9999;$W.buffersize=$B;}" | |
title %title% | |
color %color_orange% | |
::skip intro | |
if %debugmode% EQU 1 ( | |
::set UI Information | |
echo/ | |
powershell Write-Host "%title% Startup skipped" -ForegroundColor Magenta | |
echo/ | |
goto filesystem_check | |
) | |
@REM echo ------------------------------------------------------------------------------------------------- | |
@REM echo ------------------------------------------------------------------------------------------------- | |
@REM echo -------------------------------------Minecraft Server Startup------------------------------------ | |
@REM echo ------------------------------------------------------------------------------------------------- | |
@REM echo ------------------------------------------------------------------------------------------------- | |
powershell Write-Host "-------------------------------------------------------------------------------------------------" -ForegroundColor Red | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
powershell Write-Host "-----------------------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
echo/ | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
powershell Write-Host "------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "%title% Startup" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "-----------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
echo/ | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
powershell Write-Host "-----------------------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -ForegroundColor Red | |
powershell Write-Host "-------------------------------------------------------------------------------------------------" -ForegroundColor Red | |
echo/ | |
:filesystem_check | |
::set UI Information | |
powershell Write-Host "Filesystem check started!" -ForegroundColor Green | |
echo/ | |
::server files | |
if not exist "%install:~1,-1%\" ( | |
mkdir "%install:~1,-1%" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Install Folder created! | |
echo/ | |
) | |
) else ( | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Install Folder found! | |
echo/ | |
) | |
) | |
::Backup Input | |
if not exist "%Backup_Stored_IN:~1,-1%\" ( | |
mkdir "%Backup_Stored_IN:~1,-1%" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Backup Input Folder created! | |
echo/ | |
) | |
) else ( | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Backup Input Folder found! | |
echo/ | |
) | |
) | |
::Backup Output | |
if not exist "%Backup_Stored_OUT:~1,-1%\" ( | |
mkdir "%Backup_Stored_OUT:~1,-1%" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Backup Output Folder created! | |
echo/ | |
) | |
) else ( | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Backup Output Folder found! | |
echo/ | |
) | |
) | |
if not exist "%Backup_Stored_OUT:~1,-1%\keep online.ini" ( | |
copy "%special_templates:~1,-1%\keep online.ini" "%Backup_Stored_OUT:~1,-1%\keep online.ini" | |
echo/ | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Backup Keep Synced File created! | |
echo/ | |
) | |
) else ( | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Backup Keep Synced File found! | |
echo/ | |
) | |
) | |
if not exist "%Backup_Caller:~1,-1%" ( | |
powershell Write-Host "No Backup Script was found!" -ForegroundColor Red | |
echo/ | |
pause /NOBREAK >nul | |
) else ( | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Backup Script found! | |
echo/ | |
) | |
) | |
::set UI Information | |
powershell Write-Host "Filesystem check finished!" -ForegroundColor Green | |
echo/ | |
::prepare | |
cd "%install:~1,-1%" | |
if errorlevel 0 if NOT errorlevel 1 ( | |
echo/ | |
) else ( | |
powershell Write-Host "Error, please Check!" -ForegroundColor Red | |
echo/ | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
powershell Write-Host "No Server Folder was found!" -ForegroundColor Red | |
echo/ | |
) | |
pause /NOBREAK >nul | |
) | |
:update_Section | |
:prepare_update | |
set /p update_check=Check for updates? [y/n]: | |
echo/ | |
%LowerCase%%update_check% | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo Input: %update_check% | |
echo Output: %converted% | |
echo/ | |
) | |
if %converted% equ yes ( | |
goto start_update | |
) else ( | |
if %converted% equ y ( | |
goto start_update | |
) else ( | |
if %converted% equ ja ( | |
goto start_update | |
) else ( | |
if %converted% equ j ( | |
goto start_update | |
) else ( | |
if exist "%install:~1,-1%\libraries" ( | |
powershell Write-Host "Forge ist installiert!" -ForegroundColor Green | |
echo/ | |
goto start_Section | |
) else ( | |
goto start_update | |
) | |
) | |
) | |
) | |
) | |
:start_update | |
::del old forge installer | |
if exist "%install:~1,-1%\forge-%mc_version%-*-installer.jar" ( | |
del "%install:~1,-1%\forge-%mc_version%-*-installer.jar" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo old Forge Installer removed! | |
echo/ | |
) | |
) | |
::del old forge files | |
if exist "%install:~1,-1%\libraries" ( | |
rmdir /s /q "%install:~1,-1%\libraries" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo old Forge Files removed! | |
echo/ | |
) | |
) | |
::get new forge installer | |
::set UI Information | |
powershell Write-Host "Forge wird heruntergeladen" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -ForegroundColor Green | |
echo/ | |
::download installer | |
bitsadmin.exe /rawreturn /nowrap /transfer forgeinstaller /download /priority FOREGROUND %forge_url% %forge_installer% | |
if errorlevel 0 if NOT errorlevel 1 ( | |
echo/ | |
powershell Write-Host "Forge wurde erfolgreich heruntergeladen!" -ForegroundColor Green | |
echo/ | |
) else ( | |
echo/ | |
powershell Write-Host "Error, please Check Forge Download!" -ForegroundColor Red | |
echo/ | |
pause /NOBREAK >nul | |
) | |
::set UI Information | |
mode con lines=%cmd_height% cols=%server_width% | |
powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%server_width%;$B.height=9999;$W.buffersize=$B;}" | |
::install forge | |
::set UI Information | |
powershell Write-Host "Forge wird installiert" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -ForegroundColor Green | |
echo/ | |
%java_path% -jar %forge_installer% -installServer | |
if errorlevel 0 if NOT errorlevel 1 ( | |
echo/ | |
powershell Write-Host "Forge wurde erfolgreich installiert!" -ForegroundColor Green | |
echo/ | |
) else ( | |
echo/ | |
powershell Write-Host "Error, please Check Forge Installation!" -ForegroundColor Red | |
echo/ | |
pause | |
) | |
::set UI Information | |
powershell Write-Host "Standart Configuration wird geladen" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -ForegroundColor Green | |
echo/ | |
::eula accept | |
if not exist "%install:~1,-1%\eula.txt" ( | |
( | |
echo #By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula) | |
echo eula=true | |
)> "%install:~1,-1%\eula.txt" | |
echo/ | |
echo applying EULA | |
echo/ | |
) | |
::create server config | |
if not exist "%config:~1,-1%" ( | |
echo creating Server Config | |
echo/ | |
( | |
echo #Minecraft server properties | |
echo allow-flight=true | |
echo allow-nether=true | |
echo broadcast-console-to-ops=true | |
echo broadcast-rcon-to-ops=true | |
echo difficulty=normal | |
echo enable-command-block=false | |
echo enable-jmx-monitoring=false | |
echo enable-query=true | |
echo enable-rcon=%rcon_on% | |
echo enable-status=true | |
echo enforce-whitelist=false | |
echo entity-broadcast-range-percentage=100 | |
echo force-gamemode=false | |
echo function-permission-level=2 | |
echo gamemode=survival | |
echo generate-structures=true | |
echo generator-settings={} | |
echo hardcore=false | |
echo hide-online-players=false | |
echo level-name=savegame | |
echo level-seed=%seed% | |
echo level-type=default | |
echo max-players=%players% | |
echo max-tick-time=-1 | |
echo max-world-size=29999984 | |
echo motd=MC hosted by EcMIn | |
echo network-compression-threshold=256 | |
echo online-mode=true | |
echo op-permission-level=4 | |
echo player-idle-timeout=0 | |
echo prevent-proxy-connections=false | |
echo pvp=%pvp% | |
echo query.port=%Port% | |
echo rate-limit=0 | |
echo rcon.password=%rcon_pw% | |
echo rcon.port=%rcon_port% | |
echo require-resource-pack=false | |
echo resource-pack= | |
echo resource-pack-prompt= | |
echo resource-pack-sha1= | |
echo server-ip=%IP% | |
echo server-port=%Port% | |
echo simulation-distance=10 | |
echo spawn-animals=true | |
echo spawn-monsters=true | |
echo spawn-npcs=true | |
echo spawn-protection=%spawn_protect% | |
echo sync-chunk-writes=true | |
echo text-filtering-config= | |
echo use-native-transport=true | |
echo view-distance=%view_distance% | |
echo white-list=%whitelist% | |
)> "%config:~1,-1%" | |
echo/ | |
) | |
::create ip block list | |
if not exist "%install:~1,-1%\banned-ips.json" ( | |
echo creating IP Blocklist | |
copy "%special_templates:~1,-1%\banned-ips.json" "%install:~1,-1%\banned-ips.json" | |
echo/ | |
) | |
::create player block list | |
if not exist "%install:~1,-1%\banned-players.json" ( | |
echo creating Player Blocklist | |
copy "%special_templates:~1,-1%\banned-players.json" "%install:~1,-1%\banned-players.json" | |
echo/ | |
) | |
::create playernname chache | |
if not exist "%install:~1,-1%\usernamecache.json" ( | |
echo create Player Chache | |
copy "%special_templates:~1,-1%\usernamecache.json" "%install:~1,-1%\usernamecache.json" | |
echo/ | |
) | |
::set admin users | |
if not exist "%install:~1,-1%\ops.json" ( | |
echo set admin users | |
copy "%special_templates:~1,-1%\ops.json" "%install:~1,-1%\ops.json" | |
echo/ | |
) | |
::set whitelist | |
if not exist "%install:~1,-1%\whitelist.json" ( | |
echo applying Whitelist | |
copy "%special_templates:~1,-1%\whitelist.json" "%install:~1,-1%\whitelist.json" | |
echo/ | |
) | |
::set server image | |
if not exist "%install:~1,-1%\server-icon.png" ( | |
echo applying Server Icon | |
copy "%special_templates:~1,-1%\server-icon.png" "%install:~1,-1%\server-icon.png" | |
echo/ | |
) | |
::copy server start script | |
if not exist "%install:~1,-1%\StartJava.bat" ( | |
echo create Server Startscript | |
copy "%special_templates:~1,-1%\StartJava.bat" "%install:~1,-1%\StartJava.bat" | |
echo/ | |
) | |
::del basic start files | |
if exist "%install:~1,-1%\startserver.bat" ( | |
del "%install:~1,-1%\startserver.bat" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo deleted startserver.bat | |
echo/ | |
) | |
) | |
if exist "%install:~1,-1%\startserver.sh" ( | |
del "%install:~1,-1%\startserver.sh" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo deleted startserver.sh | |
echo/ | |
) | |
) | |
if exist "%install:~1,-1%\user_jvm_args.txt" ( | |
del "%install:~1,-1%\user_jvm_args.txt" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo deleted user_jvm_args.txt | |
echo/ | |
) | |
) | |
if exist "%install:~1,-1%\run.bat" ( | |
del "%install:~1,-1%\run.bat" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo deleted run.bat | |
echo/ | |
) | |
) | |
if exist "%install:~1,-1%\run.sh" ( | |
del "%install:~1,-1%\run.sh" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo deleted run.sh | |
echo/ | |
) | |
) | |
::del uneccessary log file | |
if exist "%install:~1,-1%\installer.log" ( | |
del "%install:~1,-1%\installer.log" | |
::debuginfo | |
if %debugmode% EQU 1 ( | |
echo deleted installer.log | |
echo/ | |
) | |
) | |
::set UI Information | |
echo/ | |
echo deleted uneccessary files | |
echo/ | |
::set UI Information | |
powershell Write-Host "Configuration erfolgreich geladen" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -ForegroundColor Green | |
echo/ | |
timeout /T 5 /NOBREAK >nul | |
:start_Section | |
::set UI Information | |
mode con lines=%server_height% cols=%server_width% | |
powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%server_width%;$B.height=9999;$W.buffersize=$B;}" | |
color %color_green% | |
::skip intro | |
if %debugmode% EQU 1 ( | |
::set UI Information | |
echo/ | |
powershell Write-Host "%title% Start skipped" -ForegroundColor Magenta | |
echo/ | |
goto server_start | |
) | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
@REM echo --------------------------------------------------------------------------Minecraft Server Startet-------------------------------------------------------------------------- | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
powershell Write-Host "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -ForegroundColor Green | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Green | |
echo/ | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "-------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "%title% Startet" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "-------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Green | |
echo/ | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -ForegroundColor Green | |
powershell Write-Host "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -ForegroundColor Green | |
echo/ | |
:server_start | |
::set async mode | |
setlocal EnableDelayedExpansion | |
::check ldt generator running | |
for /f "TOKENS=2" %%a in ('tasklist /nh /fi "WINDOWTITLE eq %ldt_generator_name:~1,-1%"') do Set PID=%%a | |
if %PID% gtr 0 ( | |
if %PID% equ Es ( | |
start "" "%ldt_generator:~1,-1%" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo ldt generator started! | |
echo/ | |
) | |
timeout /T 5 /NOBREAK >nul | |
goto server_start | |
) else ( | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo ldt generator is running PID is %PID% | |
echo/ | |
) | |
) | |
) else ( | |
start "" "%ldt_generator:~1,-1%" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo ldt generator started! | |
echo/ | |
) | |
timeout /T 5 /NOBREAK >nul | |
goto server_start | |
) | |
::get ldt | |
for %%? in ("%templates:~1,-1%\_ldt\*.ini") do set ldt=%%~n? | |
::set UI Information | |
powershell Write-Host "Timestamp:" -NoNewLine -ForegroundColor Green | |
powershell Write-Host ":" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "%ldt%" -ForegroundColor Magenta | |
echo/ | |
::prepare logs folder | |
mkdir "%logs:~1,-1%\%ldt%" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo Log Folder %ldt% created! | |
echo/ | |
) | |
::start Backup_Caller | |
start "" "%Backup_Caller:~1,-1%" | |
::start Server | |
call .\StartJava.bat | |
echo/ | |
::set UI Information | |
::skip intro | |
if !debugmode! EQU 1 ( | |
::set UI Information | |
echo/ | |
powershell Write-Host "%title% closed" -ForegroundColor Magenta | |
echo/ | |
goto close_Section | |
) | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
@REM echo -------------------------------------------------------------------------------Server Closed!------------------------------------------------------------------------------- | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
@REM echo ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
powershell Write-Host "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -ForegroundColor Red | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
powershell Write-Host "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
echo/ | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
powershell Write-Host "------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "Server Closed." -NoNewLine -ForegroundColor Red | |
powershell Write-Host "------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
echo/ | |
powershell Write-Host "-" -NoNewLine -ForegroundColor Red | |
powershell Write-Host "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "-" -ForegroundColor Red | |
powershell Write-Host "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------" -ForegroundColor Red | |
echo/ | |
:close_Section | |
::close Backup Caller | |
for /f "tokens=2" %%a in ('tasklist /V /FI "IMAGENAME eq cmd.exe" ^| find /i "%title% Backup"') do taskkill /pid %%a | |
::start Backup Caller only onetime | |
set single_backup=1 | |
start /wait "" "%Backup_Caller:~1,-1%" | |
echo/ | |
set single_backup=0 | |
::set UI Information | |
powershell Write-Host "Logs werden verarbeitet" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -ForegroundColor Green | |
echo/ | |
::move logs | |
if exist "%install:~1,-1%\logs\latest.log" ( | |
move "%install:~1,-1%\logs\latest.log" "%logs:~1,-1%\%ldt%\Console_%ldt%.log" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo Moved Console Log to Log Folder! | |
echo/ | |
) | |
) else ( | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo No Console Log found! | |
echo/ | |
) | |
) | |
if exist "%install:~1,-1%\logs\debug.log" ( | |
move "%install:~1,-1%\logs\debug.log" "%logs:~1,-1%\%ldt%\Detailed_%ldt%.log" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo Moved Deatailed Log to Log Folder! | |
echo/ | |
) | |
) else ( | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo No Detailed Log found! | |
echo/ | |
) | |
) | |
if exist "%install:~1,-1%\crash-reports\*.txt" ( | |
move "%install:~1,-1%\crash-reports\*.txt" "%logs:~1,-1%\%ldt%\Crash_%ldt%.log" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo Moved Crash Log to Log Folder! | |
echo/ | |
) | |
) else ( | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo No Crash Log found! | |
echo/ | |
) | |
) | |
::del uneccessary files | |
if exist "%install:~1,-1%\logs" ( | |
rmdir /s /q "%install:~1,-1%\logs" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo Deleted Log Folder! | |
echo/ | |
) | |
echo/ | |
) else ( | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo No Log Folder found! | |
echo/ | |
) | |
) | |
if exist "%install:~1,-1%\crash-reports" ( | |
rmdir /s /q "%install:~1,-1%\crash-reports" | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo Deleted Crash Log Folder! | |
echo/ | |
) | |
echo/ | |
) else ( | |
::debuginfo | |
if !debugmode! EQU 1 ( | |
echo No Crash Log Folder found! | |
echo/ | |
) | |
) | |
::set sync mode | |
endlocal | |
::set UI Information | |
powershell Write-Host "Server startet in" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "_" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "5s" -NoNewLine -ForegroundColor Magenta | |
powershell Write-Host "_" -NoNewLine -ForegroundColor Black | |
powershell Write-Host "neu" -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -NoNewLine -ForegroundColor Green | |
powershell Write-Host "." -ForegroundColor Green | |
echo/ | |
timeout /T 5 /NOBREAK >nul | |
cls | |
goto start_Section |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment