Avoid wasting of resources by automatically start your minecraft server when a player join and stop it when no one is online
(for vanilla/modded on linux/windows/macos)
version: v2.3.0
Copyright (C) 2019-2021 gekigek99
Check the releases to download the binaries (for linux and windows)
This version was successfully compiled in go version 1.15
To compile run the command:
go build .
This is a Golang script to start a minecraft server on request and stop it when there are no players online. How to use:
- Install your desired minecraft server
- "server-port" parameter in "server.properties" should be 25565
- Edit the parameters in config.json as needed (check definitions):
- serverDirPath
- serverFileName
- startMinecraftServer
- stopMinecraftServer
- * stopMinecraftServerForce
- * hibernationInfo and startingInfo
- * timeBeforeStoppingEmptyServer
- * checkForUpdates
- * put the frozen icon you want in "path/to/server.jar/folder" (must be 64x64 and called "server-icon-frozen.png")
- on the server: open port 25555 (example: ufw firewall)
- on the router: forward port 25555 to server (tutorial)
- you can connect to the server through port 25555
* = it's not compulsory to modify this parameter
(remember to run the script at reboot)
Commands to start and stop minecraft server:
# only text in braces needs to be modified (remember to remove all braces)
"ServerDirPath": "{path/to/server/folder}",
"ServerFileName": "{server.jar}",
"StartMinecraftServer": "java {-Xmx1024M -Xms1024M} -jar serverFileName nogui",
"StopMinecraftServer": "stop",
"StopMinecraftServerForce": ""
# the StopMinecraftServerForce parameter is used to execute special commands when a forced shutdown happens
Hibernation and warming up server description
"HibernationInfo": " &fserver status:\n &b&lHIBERNATING",
"StartingInfo": " &fserver status:\n &6&lWARMING UP",
60 seconds is the time (after the last player disconnected) that the script waits before shutting down the minecraft server
"TimeBeforeStoppingEmptyServer": 60 #any parameter more than 30s is recommended
set to false if you don't want to check for updates
"CheckForUpdates": true
Author: gekigek99
Contributors: najtin f8ith Br31zh
Docker branch: lubocode