Skip to content
Powrót do bloga
Minecraft Server Hibernation proxy listening on port with frozen server icon displayed

Minecraft Server Hibernation: Stop Wasting CPU When Nobody's Playing

ice
ice
@ice
Updated
72 wyświetleń
TL;DR:Minecraft Server Hibernation automatically starts your server when players join and shuts it down when everyone leaves, saving CPU and electricity. A simple, lightweight tool that's perfect for casual friend groups or small modded communities that don't need 24/7 hosting.

"Autostart and stop minecraft-server when players join/leave"

gekware/minecraft-server-hibernation · github.com
⭐ 465 stars💻 Go📜 GPL-3.0

Running a Minecraft server 24/7 is wasteful. Whether you're hosting for a friend group or a small modded community, your server's eating CPU and electricity whether anyone's actually online or not. Minecraft Server Hibernation (MSH) solves this by automatically spinning your server up when a player joins and shutting it down when the last person leaves. It's a simple idea that saves real money and resources.

What This Project Does

Minecraft Server Hibernation is a lightweight proxy written in Go that sits between your players and your actual server. When someone tries to connect, MSH detects them, boots up your real server in the background, and forwards their connection. Once everyone's gone and a timeout period expires (configurable), MSH kills the server and goes back to sleep.

You don't need to change how you connect to your server. Players just join like normal, except now the server magically starts when they show up.

The project tracks how long it's put servers in hibernation across all users: over a thousand cumulative years of CPU-time saved since 2019. That's not nothing.


Why You'd Use This

Most people running servers fall into a few camps. You've got casual friend groups that play sporadically, maybe a few hours a week. You've got small modded communities with 10-20 active players who log in at certain times. You've got people who want to mess around with a server but don't want to pay for hosting 24/7. For any of these situations, paying for a server that's idle 16 hours a day is just money in the trash.

The secondary benefit is actual convenience. No more manually starting your server before your friends get on, or scrambling when someone says "let's hop on tonight." They join, the server starts, you're in a game within 15 seconds. Boots back down automatically when the last player leaves.

And if you've got a modded server with a heavy modlist? Cutting out 8 hours of idle server time per day adds up to real power savings, especially if you're running this on hardware in your house instead of a rental machine.


Getting It Running

Setup's straightforward once you understand the pieces. You're going to download the MSH executable for your OS (Linux, Windows, or macOS), create a config file, point it at your existing Minecraft server, and run it.

GitHub project card for gekware/minecraft-server-hibernation
GitHub project card for gekware/minecraft-server-hibernation

First, grab the latest release from GitHub:

bash
cd /home/user/minecraft-server-hibernation
wget https://github.com/gekware/minecraft-server-hibernation/releases/download/v2.5.1/msh-v2.5.1-fd9f22d-linux-amd64.bin
chmod +x msh-v2.5.1-fd9f22d-linux-amd64.bin

You'll also need to download the sample config file from the releases page and edit it. The important settings:

  • Folder - path to your server directory (where server.jar lives)
  • FileName - the actual server jar filename
  • StartServerParam - launch arguments (usually something like "-Xmx4G -Xms4G -jar server.jar nogui")
  • StopServer - how to gracefully shut the server down (keyboard commands like "save-all" and "stop")
  • TimeBeforeStoppingEmptyServer - how long to wait after the last player leaves before killing the server (in seconds)

Port forwarding comes next. On your router, forward port 25555 (or whatever port you set in config) to your server machine. Then open that port on your server's firewall.

If you're on Linux with UFW:

bash
sudo ufw allow 25555/tcp

Drop the executable in your server folder, run it, and you're done.

bash
./msh-v2.5.1-fd9f22d-linux-amd64.bin

Players connect using your actual server port (25555 by default), and MSH handles everything behind the scenes.


Key Features That Matter

The tool has some thoughtful touches beyond just "start and stop."

Custom Server Icon - You can drop a frozen server icon (image called `server-icon-frozen`) in your server folder, and MSH will show it to players while the actual server's waking up. Looks cleaner than a generic offline state.

Whitelist Support - You can configure a whitelist right in MSH, or it'll respect your server's existing whitelist. Control who can even wake up the server.

Graceful shutdown is built in. MSH doesn't just kill the process. So it sends proper stop commands and waits for the server to save and quit cleanly, so you don't corrupt your world.

Configurable Idle Timeout - Want your server to stay alive for 5 minutes after the last player leaves, or 30 minutes? You control it. Gives players time to come back without the server dying the second they disconnect.

Cross-platform - Works on Linux, Windows, and macOS, and supports both vanilla and heavily modded servers. The project's been around since 2019 and is actively maintained (latest release was just v2.5.1 with improvements to crash handling and updated Go compilation).


Gotchas and Things to Know

First thing: the config file doesn't auto-generate. You've to download it from the releases page or create it yourself. No magic here.

Ancient dwellers in Minecraft
Ancient dwellers in Minecraft

Second, server.properties needs one setting: `server-ip=0.0.0.0`. If it's set to a specific IP, MSH can't reach your server properly and you'll get connection errors. It's easy to miss and annoying to debug.

Cold starts take a few seconds. When a player connects, there's a lag while the server boots and loads chunks. For most groups this is fine ("server's starting, give it a sec"). For speedrunners or hyper-competitive play, it might matter.

Make sure you've actually port-forwarded correctly. MSH listens on your specified port but needs to be reachable from outside your network. If friends can't connect, 9 times out of 10 it's a port-forwarding issue, not MSH.

One more thing: if you restart your host machine, make sure MSH starts automatically on boot. Run it as a systemd service on Linux or a scheduled task on Windows so you're not manually starting it every time.


What About Alternatives

There are a few other tools in this space. Docker containers with some scripting can do similar things, but they're more complex to set up. Some host providers offer built-in auto-start features, but you're locked to their infrastructure and usually paying extra.

There's also the nuclear option: set up a cron job that checks if your server's running and starts/stops it based on player count. Real talk, works, but you're maintaining shell scripts instead of using a tool designed for this specific job.

MSH's advantage is that it's a single binary that's been refined over 6+ years. It's not overthinking the problem, and it works offline (no cloud dependency or external services).

If you're building a server for yourself or a small group and you care about efficiency, it's worth the 20 minutes to set up.

Looking for more tools to improve your server? Check out the Minecraft Server List for inspiration on what other communities are running, or use handy utilities like the Nether Portal Calculator and Minecraft Text Generator for your gameplay.

Frequently Asked Questions

What license is minecraft-server-hibernation under?
minecraft-server-hibernation is licensed under GPL-3.0, making it free and open-source. You can download, modify, and redistribute it as long as you follow the GPL-3.0 terms. The source code and compiled binaries are both available on GitHub.
Does minecraft-server-hibernation work with modded servers?
Yes, MSH works with both vanilla and heavily modded Minecraft servers. Since it's a proxy that forwards connections to your actual server, it doesn't care what mods you're running. Tested with Forge, Fabric, and other mod loaders.
How long does it take for a server to start when a player connects?
Startup time varies based on your hardware and modlist, but typically 5-15 seconds for a vanilla server and 10-30 seconds for a heavily modded one. Players will see the frozen server icon while MSH boots the server in the background.
Can I run minecraft-server-hibernation on Windows?
Yes, MSH supports Windows, macOS, and Linux. Grab the Windows executable from the GitHub releases page, set up the config file, and run it. Port forwarding and firewall rules work the same way.
What happens to unsaved changes if the server is idle?
MSH shuts down gracefully by sending proper stop commands (like save-all and stop) to your server, not by killing the process. Your world saves properly before the server shuts down, so no data loss.