Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 36
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, 04:22 PM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,694

Rep: Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566
Put this in your crontab
@reboot screen -U -a -d -m java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
Old 10-28-2013, 09:36 AM   #3
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 203

Rep: Reputation: 42

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

 @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:

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


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

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

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