Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Say I'm running a minecraft server on my ubuntu server and I log into this machine from a remote ubuntu machine over ssh. I startup the server running a script I have e.g. minecraft.

If I want to log out and keep the server running, I usually minecraft &. say I actually log out after running minecraft &. I log back in an want to restore the same info window I get when I originally ran minecraft &. How would I restore this?

share|improve this question
    
A search for screen minecraft on Google, on this site and on Unix Stack Exchange is likely to turn up a few articles that'll interest you. –  Gilles Nov 2 '11 at 23:38
add comment

4 Answers 4

You can use byobu. It can be installed easily by with

sudo apt-get install byobu

and can be started with

byobu

You can set an option through the menus that it will be automatically started when you ssh into the server.

byobu is a front-end that uses screen. It allows the convenient usage of multiple terminal windows through one ssh connection.

share|improve this answer
1  
wow byobu is awesome so far! how do you close a window? nothing about it in their quickstart guide –  tester Nov 2 '11 at 17:40
1  
ah nevermind. found it in this guide: linuxaria.com/howto/screen-byobu?lang=en (Ctrl+a k) –  tester Nov 2 '11 at 17:43
    
Say I setup byobu-enable (so it starts every time) and I reboot my server, will byobu restore my processes? –  tester Nov 2 '11 at 18:43
    
after reading through this, it looks like screen doesn't do it by default.. brainscraps.wikidot.com/resurrect –  tester Nov 2 '11 at 18:47
add comment

You can use screen or tmux to do this. screen is used more and installed by default, so if you are new to this it's probably best to start with that. Also recommended when you use screen is Byobu (screencast video here), which is a wrapper around screen that makes it easier to use and adds lots of useful extensions to screen (and in the future it will also support tmux).

share|improve this answer
add comment

If the server's interface is console-only, you can use GNU screen to get the persistence you want. If it's graphical, use VNC or nx for persistence.

Or if you don't care about reattaching the process later on, the nohup ("no hangup") command will run a process that ignores the terminate signal triggered when the ssh session ends.

share|improve this answer
add comment

Look into GNU Screen. It allows long-running programs to execute, and you can "detach" and "reattach" to these sessions at will.

Search the software centre for "screen". The package name is screen.

To detach, just close the ssh session with the red X, (don't exit). Or type ctrl-a d.

To reattach, do

screen -r <screen-id>

Where can be obtained from

screen -list
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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