Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to run a minecraft server on linux. Running the server starts an important interactive session. I can run the server in the background by appending & at the end of the command and log off the server. But then I don't know how to get back to that interactive session when I log back in.

I know about screen, but it seems like there should be a better way of running processes in the background and being able to go into them later.

share|improve this question

migrated from serverfault.com Nov 20 '12 at 12:26

This question came from our site for professional system and network administrators.

    
@SvenW if you make that comment into a answer I'll credit you –  at. Nov 27 '12 at 16:33
add comment

2 Answers

up vote 2 down vote accepted

screen (or tmux) is the best option for this and written for exactly this purpose.

share|improve this answer
    
Or dtach. (See questions tagged with dtach). –  manatwork Nov 27 '12 at 16:50
add comment

This is the proper way to do it:

  • Start the process without the &
  • Use Ctrl-Z to suspend the process
  • Execute on that command line the process bg. This will take your process to the background as if you had it executed using the &.
  • At any point in time you can bring your process to the foreground by using fg
  • Also, you can get a list of currently executing processes by executing jobs
share|improve this answer
    
Sounds perfect, can I log out of the ssh session while a process is bg'ed and then log back in and fg into it? –  at. Nov 25 '12 at 9:19
    
no, you can't. To achieve that, as already stated by SvenW, you should use screen or tmux. –  Gonzalo Alvarez Nov 27 '12 at 10:54
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.