3

When I play mulit-player Minecraft, with my family, I use an external server. Everyone once in a while the session drops in my local PC. I can re-open a new terminal and log back into the server. I can use ps aux|grep minecraft to see that the original process is still running, but I cannot see the activity or enter commands. Is there anyway I can join that running process?

What I am saying is that when I had the terminal session open and started Minecraft (MC), I could enter commands into the MC server like /list to see users, /weather clear to stop rain, etc.. etc..
When I lost the connection and logged back in I cannot see the activities going on in the server window. I can see the process is still running, but what I wanted to do was to be able to join the process as before, and enter MC commands again.

closed as unclear what you're asking by kos, waltinator, Eric Carvalho, muru, Luís de Sousa Apr 13 '16 at 13:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    maybe you are looking for something like screen or tmux – incBrain Apr 9 '16 at 19:38
  • or try reptyr – A.B. Apr 9 '16 at 19:39
  • I use screen as soon as I login to the server, so I can open multiple xterm sessions. One xterm is used to launch the server and will show the minecraft server activity, a second xterm I use for htop and dstat to monitor for bottlenecks. However, when I relog those screen sessions are not available. I use Ctrl-A 0 and Ctrl-A 1 to see them but they don't work upon a relog. – Phil Apr 9 '16 at 19:41
  • 2
    Possible duplicate of How to detach a screen on a terminal? – cmks Apr 9 '16 at 21:22
  • @cmks They said Ctrl+A doesn't work. I'm not sure why that would be the case but @ Phil, could you clarify what happens when you try to reattach to the screen session? Please edit that information into your question, along with the information you provided with your last comment. – kos Apr 10 '16 at 2:10
4

GNU Screen is a tool that lets you reattach to a previous session. Just install it on your remote server.

apt-get install screen

Now when you connect to the machine via SSH, just type screen and press Space. You will be back to your normal terminal. Run whatever you want (minecraft) here.

Now assume your connection dropped. Buy don't worry, because it is still running in the screen session you created before. All you have to do is to re-SSH and the attach to the already running screen session. You can get a list of running sessions by:

screen -ls

From the list, choose the session you want to connect to and type:

screen -r <session-name>

And you are back!

This is one of the many awesome things you can do with screen. I have written only the minimal usage information required to achieve what the OP wanted. Here is a good tutorial if you are interested.

To exit the screen session, just type exit.

Not the answer you're looking for? Browse other questions tagged or ask your own question.