LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 10-27-2013, 05:04 PM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Ubuntu Server LTS 14.04.1
Posts: 472

Rep: Reputation: 34
Talking Run a command at start up that uses screen.


Hey LQ,

I'm trying to make my new vps launch a minecraft server when the vm boots. I know this is probably pretty straight forward, but I want to run the minecraft server from a new screen, so that I can reattach to it when ssh into it later.

Normally I do

screen -S "mc-server" and this gives me a new screen with a prompt.

then I do

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

then I do

ctrl+a+d to exit the screen and then log out of putty.

Any tips in the right direction would be swell. thank you.
 
Old 10-27-2013, 05:22 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,653

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
Put this in your crontab
Quote:
@reboot screen -U -a -d -m java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
 
Old 10-28-2013, 10:36 AM   #3
Turbocapitalist
Member
 
Registered: Apr 2005
Distribution: Ubuntu, Debian, OS X (bsd)
Posts: 156

Rep: Reputation: 30
tmux

You can also do it in tmux in a similar manner:

Code:
 @reboot tmux new-session -ds mc-server 'java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui'
Then to reconnect, it would be like this from the shell:

Code:
tmux attach -t mc-server
If you need to share the mc server with others, there are ways to make it read-only.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Start->Run command in GNOME? concoran Linux - Newbie 3 03-26-2008 09:09 AM
start xterm and run command? P-P Linux - Software 3 01-19-2007 07:35 PM
Run Shell COmmand on start-up evilmonkey Linux - Software 3 05-21-2006 06:24 PM
How to run a command automatically on start up TKD Suse/Novell 6 11-03-2005 05:41 AM
New to XFCE4 how do I run a command at its start. Royle Debian 1 02-19-2005 01:11 PM


All times are GMT -5. The time now is 10:24 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration