Skip to content

1MB CheckPort.sh

Floris edited this page Dec 16, 2021 · 2 revisions

A little helper script that can be run stand alone. Running it inside a folder with a server.properties file, will try to grab the configured server port and prints out if it found a daemon listening on this port (or not). If it can't find the port it will try to fall back on the default Minecraft server port (25565). With a bit of coding you can hook this into 1MB's start script to guarantee on a crash and restart, etc, that you only start a server if the ports are available.

Internally we use this for test servers to auto configure available server ports. It's also possible to run this to get a list of available procs, spitting out which ports they're listening on. This is made for my macOS, and made compatible with most Ubuntu versions. Works on Java 8 to Java 17, 64bit.

Source and download:

Clone this wiki locally