Hello,
To help many beginning server builders I’m going to share my personal .batch file that includes a nice title for each CMD window, a few start and stop messages and a crash detection mechanism.
The crash mechanism makes use of a free tool that can be downloaded on PsPing - Sysinternals | Microsoft Learn.
The tool itself tracks if a certain port is in use.
When we point it to the port of our server it will test if the server is reachable.
If not the server has most likely crashed and will be restarted.
A quicktutorial:
- Create a new textdocument and paste these lines of text:
TITLE Lobby
@echo off
:Start
echo (%time%) Starting the Lobby server on port 25571…
java -Xmx2048M -Xms2048M -jar spongevanilla-1.8.9-3.1.0-BETA-248.jar
echo (%time%) WARNING: Minecraft closed or crashed, restarting.
psping.exe -n 1 127.0.0.1:25571 >nul
goto Start
-
Edit the title (the text after TITLE ), start and restart messages (the lines that start with echo, %time% just displays the time), server execution command (this can also point to webservers, databases and etc.) and the IP and port number(PsPing uses this format IP:Port) to your needs.
-
Save the file as “All Types”, name it “Start.bat” and place it in the folder of your server.
-
Download the PsTools package from https://download.sysinternals.com/files/PSTools.zip
-
Open the archive by double clicking the downloaded file.
-
Move the “psping.exe” file to your server’s folder.
-
Start your server using a double click on the newly created startup script “Start.bat”.
-
Your server will start as normally but just a few additions.
- To stop your server simply type stop and wait till the server has saved its files and the text “WARNING: Minecraft closed or crashed, restarting.” appears than press the close button.
If there are any additions or errors In the startup script please tell them to me.
Yours,
Hiero247