Saturday, July 4, 2020

BATCH FILE RE-STARTER & BACKUP

I run an elaborate batch-file re-starter. It monitors the server for functionality, if it crashes, it will auto reboot, with an option to cancel it. This file works with the backup.bat file. Both of these are modified versions of my BLAZE batch files.

Please do not post this script anywhere else without credit, permission, or linkback


STARTSERVER.BAT FILE

@echo off
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: :::: B L A Z E  S T A R T S E R  E R . B A T          ::::
:: :::: THIS MINECRAFT SERVER RE-STARTER SHOULD BE USED  ::::
:: :::: IN CONJUNCTION WITH THE BLAZE BACKUP.BAT         ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

title Minecraft Server Starter

:: NEED ABSOLUTE PATH TO MINECRAFT SERVER
c:
cd "\xampp\htdocs\blaze\mcserver\"

:: LOAD UP THE BATCH FILE
start /min "SERVER_BACKUP" backup.bat

:LOAD_SERVER
cls
echo   @@@@@@ @@@@@@@@ @@@@@@@  @@@  @@@ @@@@@@@@ @@@@@@@      
echo  !@@     @@!      @@!  @@@ @@!  @@@ @@!      @@!  @@@     
echo   !@@!!  @!!!:!   @!@!!@!  @!@  !@! @!!!:!   @!@!!@!      
echo      !:! !!:      !!: :!!   !: .:!  !!:      !!: :!!      
echo  ::.: :  : :: :::  :   : :    ::    : :: :::  :   : :     
echo.                                                          
echo  @@@@@@@  @@@  @@@ @@@  @@@ @@@  @@@ @@@ @@@  @@@  @@@@@@@
echo  @@!  @@@ @@!  @@@ @@!@!@@@ @@!@!@@@ @@! @@!@!@@@ !@@     
echo  @!@!!@!  @!@  !@! @!@@!!@! @!@@!!@! !!@ @!@@!!@! !@! @!@!@
echo  !!: :!!  !!:  !!! !!:  !!! !!:  !!! !!: !!:  !!! :!!   !!:
echo   :   : :  :.:: :  ::    :  ::    :  :   ::    :   :: :: :
echo.                                                                           

:: LET BACKUP BATCH KNOW THE SERVER IS UP (SORTA)
echo "server up" > server.up

:: LOAD YOUR SERVER HERE
start /wait "BLAZEMCPANEL" java.exe -Xmx4048M -Xms4048M  -jar minecraft_server.jar nogui
echo.

:: SYSTEM COMES HERE WHEN THE SERVER STOPS
:: WHAT WE DO HERE IS DO A TIME OUT INCASE THE EXIT WAS INTENTIONAL,
:: IF NOT IT WILL BE TREATED AS A CRASH
:: ALLOW 10 SECOND DELAY,
echo Server stoppped!! Server will reload in 10 seconds,
echo PRESS ANY KEY TO EXIT SERVER
call :controlTimeout 15
if errorlevel 1 (
    GOTO EXIT_SERVER
) else (
    GOTO CRASH
)
exit /b

:controlTimeout
setlocal
start "" /belownormal /b cmd /q /d /c "timeout.exe %~1 /nobreak > nul"
timeout.exe %~1 & tasklist | find "timeout" >nul
if errorlevel 1 ( set "exitCode=0" ) else (
    set "exitCode=1"
    taskkill /f /im timeout.exe 2>nul >nul
)
endlocal & exit /b %exitCode%

:CRASH
:: ADD TO LOG HERE IF CTRL-X WAS NOT PRESED
set this_date = date /t
echo Server Crashed on !this_date! >> crash.log

:: IF NOT, IT MUST HAVE BEEN A CRASH, RELOAD THE SERVER
GOTO LOAD_SERVER

:EXIT_SERVER

del /q server.up
exit 0


Please do not post this script anywhere else without credit, permission, or linkback


BACKUP.BAT
REQUIRED: 7z.exe & 7z.dll in your MC Server Directory
@echo off

:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::::         B L A Z E  B A C K U P . B A T           ::::
:: :::: THIS MINECRAFT SERVER RE-STARTER SHOULD BE USED  ::::
:: :::: IN CONJUNCTION WITH THE BLAZE STARTUP.BAT        ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: AUTHOR: R.SCORPIO rickscorpio64@gmail.com
:: WEBSITE: https://rustycraftmc.blogspot.com/

setlocal EnableDelayedExpansion
title "BACKUP SERVER"

:: SERVER BACKUP SECTION
:: I do not use a "date" format, as the files when created already have a timestamp
:: which you can see in the file explorer




:: ----------- EDIT THIS SECTION ------------------------------------

    :: put the name of the world you want to backup
    set worldname=world
    :: 600 = 10min, 900 = 15min, 1200 = 20min (add 300 seconds/5min)
    set interval=300
    :: BACKUP folder name
    set backupFolder=backups
    :: Set number of backups before counter reset. 5-10 is good for a small server
    set max_backups=25
    :: Starting counter. Really no reason to change this. Used for routine below
    set backupcount=1
   
:: ---- DO NOT EDIT PAST HERE ---------------------------------------
:backup
cls
echo "    _____                                           
echo " __|___  |__  ______  _____  __    _ ______  _____  
echo "|   ___|    ||   ___||     |\  \  //|   ___||     | 
echo " `-.`-.     ||   ___||     \ \  \// |   ___||     \ 
echo "|______|  __||______||__|\__\ \__/  |______||__|\__\
echo "   |_____|                                          
echo "    _____                                           
echo " __|___  |__  ____    ______  __  __  __   _  _____ 
echo "|      >    ||    \  |   ___||  |/ / |  | | ||     |
echo "|     <     ||     \ |   |__ |     \ |  |_| ||    _|
echo "|______>  __||__|\__\|______||__|\__\|______||___|  
echo "   |_____|                                          
                                                
echo.
:: if server.up exist, we can keep doing backups
:: this is a method used so backups do not continue if
:: the server is down.

echo Checking archive count
for %%x in ("%backupFolder%\*.7z") do (set /a "backupcount=!backupcount!+1")
if !backupcount! gtr %max_backups% ( set backupcount=1 )   

echo Copying world to backup folder.
xcopy "%worldname%\*.*" %backupFolder% /s /e /q /y

:: regarding the "^^" - I am using the setlocal EnableDelayedExpansion,
:: this makes the "!" has a special meaning and overrides the 7z ! symbol
:: the ^^ escapes the "!" so it can be used correctly
echo Archiving backup # !backupcount!
echo Processing: %backupFolder%\serverBackup_%backupcount%.7z %backupFolder%
7z a  %backupFolder%\serverBackup_%backupcount%.7z %backupFolder% -xr^^!*.7z > nul
echo DONE!
:: We need to delay interval, but we also need to check to see if the
:: server.up has left, if so, break out of batch file
set counter=0

:timer_loop
:: This loop is designed to pause 1 (ish) sec for "interval" seconds (see above)
:: each iteration(second) will check to see if server.up is still present
:: if not, then the server is down and exit the backup
if exist server.up (

    PING 0.0.0.0 -n 2 > nul
    set /a "counter=!counter!+1"
    if !counter! LSS %interval% GOTO timer_loop       
   
) else (GOTO quit)

GOTO backup



:: if the server.up does not exist, exit backup routine after it finishes loop
:: this way backup is not running while there is no live server
:quit
exit 0


 LIVE VIEW



Sunday, May 24, 2020

finally released (alpha)

OK, alpha release (which means it may be buggy). But my test work almost flawlessly.

head over to https:// www.blazemcpanel.com to keep up, and twitter https://twitter.com/blaze_panel




Thursday, May 14, 2020

BLAZE - MINECRAFT CONTROL PANEL

This is just a personal project of mine. Not sure if I will release, it, however until it is done, that decision will not be made at this point. I am currently using it to brush up and hone my PHP/JAVASCRIPT and CSS programming skills

At the top of the blog there is a page with some archived progress, feel free to check it out. I'll try to keep everything here.  The following is the recent design (May 2020). I felt that it did not need to be so large for a personal private Minecraft Server.  I welcome all comments and suggestions.




Monday, April 27, 2020

Castle Survival build

I am curently finishing up on one of the largest castle builds, in creative. Just to see it done. It is one of the largest I've seen in MC that actually has a tutorial. Not only is it a detailed castle inside and out, but even goes as far as gives a tutorial on the other buildings, inside and outside of the keep. Once I have this done, I will attempt to re-create this monster in survival mode. Since this is a time of the bogus COVID19 crap, it will give me at least a year of time to complete the project. If my ADD doesn't defeat me first.

The design is from the master builder BlueNerd. Check him out.

Here are some of my screenshots of the progress in creative. don't let the creative fool you, even with all the pieces at your fingertips, you will find it quite challenging with all the angles and measurements - this will complicate survival 100 fold!

There are lots of screenshots. I started the project in creative on 4/7/20 and this is how far i am at 4/27/20









Sunday, April 26, 2020

Intro

Just a new blog of my projects and experience in MC. Been playing it for many years, and felt it is a good time to share some of my tools I have created, maybe a few screenshots of some of my builds. Nothing much but a collections of memories for me