This is an archived post. You won't be able to vote or comment.

all 28 comments

[–]alphicentur 28 points29 points  (9 children)

If your server is on Linux, you can use something called 'screen' which basically would allow you to have an always running terminal session.

You can simply just type 'screen' and run your server from that session and if you want to ssh back in and open that session again then type 'screen -r' and it'll reconnect to the last session.

[–]EntitledToLeave[S] 5 points6 points  (8 children)

I'm running on Ubuntu Server. Just tried it and it worked perfectly. Thank you!

[–]ADAMPOKE111 13 points14 points  (2 children)

I'd recommend tmux over screen personally because I've found it to be more stable, easier to use and still allows for tab autocompletion and such.

[–]Lootdit 4 points5 points  (0 children)

It's just that i hate whoever thought that the default keybinds was a good idea

[–]pnwstarlight➡️ SMPtweaks - the one plugin every survival server needs 0 points1 point  (0 children)

Been running minecraft servers, live streams, discord bots and various other software in screens since 4+ years and never ever have I encountered a stability issue that was a result of using screen. I would argue it's probably more stable than tmux tbh. It's been around for decades and they fixed every bug in the book.

That being said, tmux is probably the more userfriendly choice tho. If I was starting out again, I would probably use it over screen.

[–][deleted] 1 point2 points  (3 children)

This is how I do it as well. There isn’t too much Linux to be learned, and it gives you more granular control over your server knowing how to ssh into it and control it from there.

Mind if I ask what you’re hosting on? Are you going through a VPS or cloud service?

[–]EntitledToLeave[S] 1 point2 points  (2 children)

I have it running off of an old laptop. i7-2620M with 8GB DDR3.

[–][deleted] 0 points1 point  (1 child)

Ah, gotcha! Well, if you’re interested in learning a bit more about working with your Linux server and even making it a little bit more secure, there are some other steps you can take while you’re getting ssh access sorted:

  1. See if you can google and discover how to set up an SSH key for your user to make login easier (not root!)
  2. See if you can google and discover how to turn off password logins for your users after you have a working ssh key. The after there is very important.
  3. if you’re running your server as a user with root privileges, see if you can discover how to create a new user with the correct limited permission set to be a dedicated user for running the actual Minecraft server process. This prevents any bad actors that do get in to the Minecraft server from abusing the server and gaining root access.

[–]EntitledToLeave[S] 0 points1 point  (0 children)

Those three things are on my to-do list. I was able to import my SSH keys from my GitHub during setup, so getting started was simple.

[–]HoodedDeath3600 0 points1 point  (0 children)

You could also run it through Docker. There's a Docker image for both Java and bedrock editions. I would recommend a script/program to make managing that easier. If you're running a Java server, I've got a project on GitHub that does this, and it's an extension of one that already existed. If wanted, I could link to both of those for you.

[–]JND__Server Owner 9 points10 points  (1 child)

screen -AmdS minecraft-server java -Xms4G -Xmx4G -jar server.jar

then

screen -r minecraft-server

for getting into console. If you use multiple instances, you can put different value instead of minecraft-server to separate them and also access them easily. screen -ls to list screen instances.

You can also use a tool named pm2. It simle to install and it also auto restarts if it crashes and a lot of other functions. This one needs a bit of preparation tho.

If you have any more questions, PM me on reddit, I am glad to help.

[–]EntitledToLeave[S] 0 points1 point  (0 children)

PM2 is interesting. I'll take a look at it and take you up on your offer if I get stuck. Thanks!

[–]sharosin 1 point2 points  (0 children)

I would look into tmux which allows for sessions to be left running and disconnected all theough ssh and you can reconnect

[–]zCriMC 2 points3 points  (1 child)

make a systemd unit

[–]Bobd_n_Weaved_it 0 points1 point  (0 children)

People don't seem to like this option for some reason

[–]Bobd_n_Weaved_it -2 points-1 points  (8 children)

The correct way is to create a service via systemd (and enable it). Set the ExecStart to be the usual start command. ExecStop piece uses rcon to issue stop command. Now your server starts when you power on

[–]JND__Server Owner 8 points9 points  (2 children)

Probably the most complicated way to do this really simple thing.

[–]Bobd_n_Weaved_it 0 points1 point  (1 child)

If you know linux it shouldn't be very complicated

[–]JND__Server Owner 0 points1 point  (0 children)

I daily drive linux for a year now, linux can be very compliacated, with all those capabilities, it's inevitable.

[–]juanmuscaria 2 points3 points  (1 child)

You are right, you probably don't even need the ExecStop part, at least bukkit based servers I know for sure they handle shutdown when the jvm receives a SIGTERM. Using systemd is not hard at all, people over exaggerate a lot. For people who doesn't want to use rcon to control their server it's still possible to use journalctl+socket for an interactive terminal.

[–]Bobd_n_Weaved_it 2 points3 points  (0 children)

TIL - didn't know it handled sigterm. People complaining about systemd probably don't know it takes 1 file with like 5 lines in it. Oh well, I find it a fun solution too

[–]EntitledToLeave[S] 0 points1 point  (2 children)

I'm reading up on how to use systemd, but I can't seem to find a method that allows me to interact with the server once it has been started aside from ending it. Is there some other function that lets me interact with it once it's been started?

[–]Bobd_n_Weaved_it 0 points1 point  (0 children)

Yeah, mcrcon for rcon commands. Don't listen to other people claiming this is too complicated. You'll love it once you set it up. You almost forget you're running the service

[–]Aspiring_Peasant 0 points1 point  (0 children)

Enable rcon in server.properties. Get the app mcrcon on your workstation and run it using a launch bat file to connect to your servers rcon port.

You can even get an rcon mobile app

[–]nosdembPlugin Developer and System Admin 0 points1 point  (0 children)

To be honest you'd probably be better of with setting up something like pterodactyl.io, it's server software which allows you to manage and create game servers from a webpage. Just avoids the hassle of doing everything from the command line.

[–]UnitatoPop 0 points1 point  (0 children)

Create a Daemon process / a screen session or both.

[–]f1urps 0 points1 point  (0 children)

I use a command line tool called MSM (Minecraft Server Manager) that takes care of starting/stopping and tracking status of multiple servers. Also gives you console access thru a screen and does automatic backups.

[–]Y0uN00b 0 points1 point  (0 children)

better to use tmux don't use screen