Minecraft Server Windows Service – Server Guide #4

Everything is starting to fall into place:

  • Decent Minecraft Server
  • Bedrock – Java Support
  • Sleeping Server Program

But one thing is missing. That, my friend, is full automation.

With the Non Sucking Service Manager (NSSM), we can install Minecraft Sleeping Server Starter as a Windows service, so we can be sure that our server is ready to play whenever our (server) PC is on.

This is simpler than you might think, but I’ll still take you through it.

Set up

Download the NSSM executable for windows from their downloads page. It should be the latest release (2.24).

Extract it to your server folder.

In the “nssm-2.24\win64” or “nssm-2.24\win32” folder (dependent on your system, should be 64 bit) there should be an executable. Cut it and paste it into the root of your server (with the sss.exe and server jar).

You can now delete the nssm-2.24 folder.

Set up is complete.

Installing a Service

Open an admin command prompt and change the directory (cd) to your server folder root.

Type in:

nssm install "(Your Service Name)" 

And it should open up a GUI that looks a little like this:

Non Sucking Service Manager Application tab

Set the “Application Path” to your “sleepingserverstarter.exe” in your server root, and make sure the “Startup directory” is set to your server root folder. You can change these by clicking the ellipses after the text boxes.

Ignore the “Arguments” and move onto the “Log on” tab. Check the Log on as: “This account” checkbox. Here you will have to enter in your username and password to the Windows account log on. I have used an example log on below.

Non Sucking Service Manager Log on tab

And press the “Install Service” button.

Your service should install. Please note that it will only install if the server files are located somewhere only the specified user has access to (like Documents.) If the server files are located in program files for example, you’ll have to tick “Local System account” on the Log on tab and “Allow service to interact with desktop”. However I’m unaware if this’ll run properly without a user logged in.

So open “services.msc” by typing it into Windows search/cortana and locate your service. Select it and start it, either by right-clicking and starting or pressing the start/play button. It should start up the Sleeping Server Starter executable in the background so you won’t be able to see it, but you can connect and join the server as normal from either Minecraft Java or Bedrock!

Services.msc

So I hope you enjoyed this guide to Minecraft Server -ing cross platform and making it fully automatic. I hope you learned something, and if you want more things like this, drop a comment/create a topic, or even something as little as subscribing to my YouTube channel. Gives me a lot of motivation 🙂

After writing this, I tested waking the server from an Xbox One S and some reason after version v1.16.201 the client it thinks over a million players are online. So just wake it from Java/Bedrock PC before joining.

Anyway, thanks for spending your time to read this blog, and if your reading from the future, leave a comment, and like a video of mine (It’s really appreciated!)

And by the way, if you ever have any issues about or with this blog or project, or just want to share your results from it, create a thread in the website Forum. Thanks!

Minecraft Server Setup Guide – Server Guide #1
Minecraft Server Bedrock Support – Server Guide #2
Minecraft Sleeping Server Program – Server Guide #3
Minecraft Sleeping Server Program – Building from repl.it – Server Guide #3.5
Minecraft Server Windows Service – Server Guide #4

Minecraft Sleeping Server Program – Building from replit.com – Server Guide #3.5

If you’ve read my previous page, which you should have (It’s very helpful), and you’re thinking:
I want a binary but I don’t want the source files on my local machine. The developer hasn’t released a build, what can I do?
Fear not, for anyone with this stupid question doesn’t have to question anymore!
You can build the project online in the cloud for free using repl.it!

Can’t be bothered? Here’s my repl, the binaries are in the /home/mcsleepingserverstarter/bin/ folder. For Linux and Windows.

Let’s get into it.

Building from replit.com

It’s quite simple. Log in or create an account with google or github. Create a repl, one of your choice that supports shell, and load it up.

Open the “Shell” tab on the right, and type in the following. (Press Enter every line.)

git clone https://github.com/vincss/mcsleepingserverstarter.git
cd mcsleepingserverstarter
npm i
npm run build:typescript
npm run build:linux/win

Builds should be in the /home/mcsleepingserverstarter/bin/ folder.

Anyway, thanks for spending your time to read this blog, and if your reading from the future, leave a comment, and like a video of mine (It’s really appreciated!)

And by the way, if you ever have any issues about or with this blog or project, or just want to share your results from it, create a thread in the website Forum. Thanks!

Minecraft Server Setup Guide – Server Guide #1
Minecraft Server Bedrock Support – Server Guide #2
Minecraft Sleeping Server Program – Server Guide #3
Minecraft Sleeping Server Program – Building from repl.it – Server Guide #3.5
Minecraft Server Windows Service – Server Guide #4

Minecraft Sleeping Server Program – Server Guide #3

We have a functioning server that can accept outbound players and players from the Bedrock Editions of Minecraft. But having a server on all day can really wear out a system, not to mention the immense electricity and compute it takes! So this page will take you through installing the SleepingServerStarter Minecraft Server plugin by Vincss and EmerickH.

Sleeping Server Starter runs in the same directory as your server and listens for incoming connections from Minecraft Java and Bedrock (1.16.5 revision, thanks to Vincss and Octoshrimpy!). Once it hears a connection from a client, it will reconnect the player and start up the server. Pretty neat if I do say so myself!
We’ll also use the EmptyServerStopper Spigot plugin to safely stop the server after all players have left. It does this after a specified amount of time.

This guide page will take you through installing the program and plugin as well as re-building /compiling it if you want to change the sleeping-state icon for the Server. I’ll be covering how to compile for windows 10. (It was easier than I thought!)

The Pre-compiled Binary

The pre-compiled binary for 1.16.5 is very easy to use, just download, extract and run in the same directory as your server. In previous versions, it was required to recompile the Binary to change the server icon, however this is no longer needed! Woohoo! But I’ll still be covering how to re-compile to support setting up for older server versions. Once it generates a

sleepingSettings.yml

you can edit it with notepad and should look similar to the following. It may look different dependent on the version of the Program your using. This version is 1.16.5, the Bedrock support update.

# settings for SleepingServerStarter

serverName: SleepingServer, waiting for his prince...

serverPort: 25565
bedrockPort: 19132
loginMessage: ...Waking server up, come back in a minute...
serverOnlineMode: true

webPort: 0	 					# 0 to disable web hosting, 8123default dynmap
webDir: plugins/dynmap/web 	# dir of dynmap web

startMinecraft: 1 				# 0 to disable	
minecraftCommand: java -jar spigot.jar nogui

# version: 1.15.2 # Force to a specific minecraft version

# Use a custom icon 64x64 png converted using https://www.base64-image.de/
# favIcon: (removed because it was too long)

Remember to set:

minecraftCommand: java -Xmx6144M -Xms6144M -jar paper-1.16.5-483.jar nogui

To your Minecraft server’s java command. Earlier in this guide we created and added a launch batch file. I’ve re-noted this above, for our sanity.

You could also set:

serverName: (Your Server Name)

to your server’s name. Plus, (new feature in the 1.16.5 release) you can change your server’s icon in the sleepingsettings.yml without recompiling. Just upload your .png to https://www.base64-image.de/ and copy the <image> code into the

favIcon: (Your base 64 converted PNG icon - really long jibberish)

entry. Make sure to remove the “#” before the entry, so that it’s not commented out.

The only downside to the Binary is that you have to manually start it every time it crashes, stops or the OS reboots. But we can circumvent this! So next guide page I’ll show you how to install it as a Windows Service, so that your Minecraft server is up and running if the computer server is powered on, and even if no users are signed into the PC. Neat, isn’t it?

Once SSS (Sleeping Server Starter) is setup, we’ll also want to install the ESS (Empty Server Stopper) plugin from here. Download, place into your plugins folder and restart. It’ll generate an Empty Server Stopper folder in /plugins/ and a config.yml inside. The only parameter defaults to 60 and is measured in minutes. Change this if you like. It’ll stop the server (Defined) minute(s) after the last player leaves.

So now that all that is nice and setup, check if it works as you like. If you’ve followed my previous guide pages, you should be able to connect and start the server from Java 1.16.5 (Your server IP – inside network local IPv4, outside network public IPv4) port 25565,
and Bedrock v1.16.100 and v1.16.200 (Your server IP) port 19132, if you have followed my previous guides and left most settings default. GeyserMC must be installed.

If you have any problems, drop a comment or create a topic in the forum.
To find my previous guide pages, head to the Projects section in the Menu (up top) and find the page.

I’ll show you now how to recompile for Windows and Linux on Windows, just in case you want to change the Sleeping state Icon on older versions. Please note that waking the Server from Bedrock on SSS older than 1.16.5 will not work. Bedrock waking support was added in the 1.16.5 update.

Re-Compiling latest release

You’ll need to have:

Ok, here is step-by-step recompiling the SSS 1.16.5 Bedrock update/latest release.

  • Open Admin cmd
cd (Project folder)
git clone https://github.com/vincss/mcsleepingserverstarter.git
cd (Project folder/mcsleepingserverstarter)

If you don’t want to install Git, just download the Source Code (zip) from the releases page and extract it to your (Project folder).

npm i

You might get an error if you are not using stable releases of Node.js. I had to uninstall a dev release and reinstall a stable release. Then re-run “npm i”.

npm start

Allow Node.js through your firewall.
Once you can confirm it works, close the cmd.

  • Re open an Admin cmd.
cd (Project folder/mcsleepingserverstarter)
npm run build:typescript
npm run build:win/linux

Binaries should be in the (Project folder)/mcsleepingserverstarter/bin/
folder. You’re free to modify the source code as you like, and then re-compile the binary. Make sure to credit the project though.

Re-Compiling previous releases

Download the source code you want from the releases page.

Extract the zip to your (Project folder)
Convert your png to an ico using https://cloudconvert.com/png-to-ico

Replace the sss.ico with yours, and edit anything else you want
More info below (per version):

FOR 1.15.1

  • Download the Source Code (zip)
  • Extract to (Project folder)
  • Edit files (sss.ico)
  • Open Admin cmd
cd (Project folder/mcsleepingserverstarter-1.15.1)
npm i
npm audit fix (if needed)
npm install -g nexe (if not previously installed)
npm run build:win/linux

FOR 1.15.2

  • Download the Source Code (zip)
  • Extract to (Project folder)
  • Edit files (sss.ico)
  • Open Admin cmd
cd (Project folder/mcsleepingserverstarter-1.15.2_release)
npm i
npm audit fix (if needed)
npm install -g nexe (if not previously installed)
npm run build:win/linux

FOR 1.16.1

  • Download the Source Code (zip)
  • Extract to (Project folder)
  • Edit files (sss.ico)
  • Open Admin cmd
cd (Project folder/mcsleepingserverstarter-1.16.1)
npm i
npm audit fix (if needed)
npm install -g nexe (if not previously installed)
npm run build:win/linux

FOR 1.16.4

  • Download the Source Code (zip)
  • Extract to (Project folder)
  • Edit files (sss.ico)
  • Open Admin cmd
cd (Project folder/mcsleepingserverstarter-1.16.4)
npm i
npm audit fix (if needed)
npm install -g nexe (if not previously installed)
npm run build:win/linux

FOR 1.16.5

  • Download the Source Code (zip)
  • Extract to (Project folder)
  • Edit files (sss.ico)
  • Open Admin cmd
cd (Project folder/mcsleepingserverstarter-1.16.5)
npm i
npm run build:typecript
npm run build:win/linux

And that should be short instructions for re-compiling binaries for SleepingServerStarter. I did overexplain 1.16.5 a bit to start with, but I thought I might as well have as it is the update most people will use. It has been converted to typescript, so will require being built using

npm run build:typecript

which will build it in javascript (Project folder/mcsleepingserverstarter/build/). Then run

npm run build:win/linux

to compile a binary. DO NOT change directories to do this. Please. <:)

Next guide page I’ll be taking you through installing the binary as a Windows service, so you only have to worry about your server being powered on!!

Anyway, thanks for spending your time to read this blog, and if your reading from the future, leave a comment, and like a video of mine (It’s really appreciated!)

And by the way, if you ever have any issues about or with this blog or project, or just want to share your results from it, create a thread in the website Forum. Thanks!

Minecraft Server Setup Guide – Server Guide #1
Minecraft Server Bedrock Support – Server Guide #2
Minecraft Sleeping Server Program – Server Guide #3
Minecraft Sleeping Server Program – Building from repl.it – Server Guide #3.5
Minecraft Server Windows Service – Server Guide #4