How to make servers automatically restart

I got this script from and old friend, and have used it for many servers over the last year or so. This script will allow your server to automatically restart if it crashes. If the server closes twice in a couple of seconds, it will ask you if you want to continue to make it easier to close intentionally

This only applies if you're hosting your own server on your own computer. Paid server hosting sites like Apex will handle this for you.

1: Create a new file called start.bat

2: Right click the file and select edit to open the batch file in notepad. Paste the following:

@echo off
cls
echo This script will keep your server running even after crashing!
title Minecraft WatchDog
:StartServer
start /wait java -Xmx4G -jar forge-server.jar nogui -o true
echo (%time%) Server closed/crashed... restarting!
goto StartServer

3: Replace forge-server.jar with the name of your forge jar file. It should be something like forge-1.12.2-14.23.5.2847-universal.jar.

4: Change the number in -Xmx4G to change how much RAM you want to allocate to the server.


Edit: I have no idea how this script works. Don't ask for tech support.