LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-21-2012, 03:58 PM   #1
Shimdidly
LQ Newbie
 
Registered: Mar 2012
Posts: 21

Rep: Reputation: Disabled
Started Minecraft in background, can't get it back to foreground.


I'm on Ubuntu Server 11.10

Here's what I did:

I used this code for start.command, note the '&' at the end
Code:
#!/bin/bash
java -Xms256M -Xmx256M -jar minecraft_server.jar nogui &
I went ahead and ran the command
Minecraft started normally
Code:
shimdidly@diwars:~/minecraft$ ./start.command
shimdidly@diwars:~/minecraft$ 177 recipes
27 achievements
2012-03-21 14:21:26 [INFO] Starting minecraft server version 1.2.3
2012-03-21 14:21:26 [WARNING] To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar"
2012-03-21 14:21:26 [INFO] Loading properties
2012-03-21 14:21:26 [INFO] Starting Minecraft server on *:25565
2012-03-21 14:21:26 [INFO] Preparing level "David is Beast"
2012-03-21 14:21:26 [INFO] Default game type: 0
2012-03-21 14:21:26 [INFO] Preparing start region for level 0
2012-03-21 14:21:27 [INFO] Preparing spawn area: 60%
2012-03-21 14:21:28 [INFO] Done (1877834749ns)! For help, type "help" or "?"
shimdidly@diwars:~/minecraft$ jobs
jobs returned nothing. I read somewhere that all I need to do to put a process in the foreground again is to use 'fg %1', but nothing at all appeared for jobs, and 'fg %1' returns 'no such job'

Last edited by Shimdidly; 03-21-2012 at 04:00 PM.
 
Old 03-21-2012, 06:25 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Kill the process. Then run Minecraft inside 'screen'. Screen sessions can be detached and re-attached easily. See 'man screen' for more.
 
1 members found this post helpful.
Old 03-21-2012, 08:06 PM   #3
Shimdidly
LQ Newbie
 
Registered: Mar 2012
Posts: 21

Original Poster
Rep: Reputation: Disabled
Done, thank you. Screens accomplishes this very nicely. So I take it is possible then for a program to fall into a "black hole" so to speak so it's still running but there's no way to ever see it again?
 
Old 03-22-2012, 03:42 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I think you answered your question yourself, yes? ;-p
 
Old 03-22-2012, 04:41 PM   #5
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Rep: Reputation: 62
I usually just use: -

nohup java -Xms256M -Xmx256M -jar minecraft_server.jar nogui >> ~/log/minecraft.log &

...but I don't see what else you'd need to achieve aside from simply running the server process. Can you manipulate the Minecraft server via some sort of foreground command line or something that requires you to bring it back to the foreground?
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tty background/foreground color neo77777 Linux - General 11 11-25-2014 08:59 AM
Foreground vs Background gothrog Linux - General 3 07-08-2011 10:13 AM
background process popping up in foreground noir911 Linux - General 1 12-14-2007 11:53 PM
How to bring a background diamon to foreground lieuquocdat Linux - Software 8 07-20-2006 06:53 AM
Background and Foreground Datamike Linux - Software 2 01-20-2006 04:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration