LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Games
User Name
Password
Linux - Games This forum is for all discussion relating to gaming in Linux.

Notices

Reply
 
Search this Thread
Old 02-27-2013, 02:45 AM   #1
JoseCuervo
Member
 
Registered: May 2007
Location: Delaware
Distribution: Ubuntu Server 12.04, Ubuntu 12.04.3, Tails 0.22, Kali
Posts: 59

Rep: Reputation: 16
Create a script to run Minecraft when a player connects


I have installed a Minecraft Server on an Ubuntu Server install. Everything works fine, my router is properly port forwarded, and I can play on the server from other computers on my network as well. The machine hosting minecraft is going to be a 24/7 box, and I want it to be as power conscious as possible. Low power CPU, spin down the hard drives, and a .6 watt SSD. I don't want Minecraft to be running all of the time, since java is a CPU hog and will drive up the electricity usage. (I am aware that adding .03kW/hrs is still very cheap, but humor me please )

How can I set up a script that detects when someone is connecting to port 25565 on the server box and then starts the Minecraft server? Minecraft takes .6 seconds to start, so the reaction time of getting the server up after someone makes a connection is small. Bonus points if you can A: tell me how to start Minecraft in a RamDisk as well, and B: tell me how to close Minecraft after all players disconnect.

At first I was just going to start a ramdisk, start Minecraft, and then let it run forever, but I'm planning a wedding, going to school, and working nights, so my Minecraft time alternates between an hour a day and an hour every two months. Since this box will mostly be for file sharing, I don't need Minecraft running all the time.
 
Old 02-27-2013, 08:19 AM   #2
yowi
Member
 
Registered: Dec 2002
Location: Au
Distribution: Debian
Posts: 209

Rep: Reputation: 52
inetd will handle the startup.
https://en.wikipedia.org/wiki/Inetd
 
Old 02-27-2013, 10:20 PM   #3
JoseCuervo
Member
 
Registered: May 2007
Location: Delaware
Distribution: Ubuntu Server 12.04, Ubuntu 12.04.3, Tails 0.22, Kali
Posts: 59

Original Poster
Rep: Reputation: 16
Thanks for pointing me at inetd, I've jumped to xinetd now and I'm looking at how to implement it. I appreciate the tip!
 
Old 02-27-2013, 11:55 PM   #4
JoseCuervo
Member
 
Registered: May 2007
Location: Delaware
Distribution: Ubuntu Server 12.04, Ubuntu 12.04.3, Tails 0.22, Kali
Posts: 59

Original Poster
Rep: Reputation: 16
In case anyone else wants to do this to Minecraft on Ubuntu Server, I found a useful website where someone has already done pretty much what I wanted. http://www.planetminecraft.com/blog/...bodys-playing/ shows how to catch an incoming Minecraft connection with xinetd, start the minecraft service, and even close minecraft after 15 minutes of disuse with cron. I'm getting it working on my system now, and I'll update anything I learn or questions that I have.
 
  


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
Error When Trying to Run Minecraft actyler1012 Linux - Games 2 02-21-2013 05:45 PM
Wondering How to Install JDK Runtime in Manjaro to Run Minecraft nickkourpias Linux - Software 6 12-11-2012 01:41 AM
LXer: Yes, the Raspberry Pi will run Minecraft LXer Syndicated Linux News 0 11-27-2012 06:41 AM
Create and run a bash script BallsOfSteel Programming 9 07-04-2008 12:48 AM
Bash Script Help - Trying to create a variable inside script when run. webaccounts Linux - Newbie 1 06-09-2008 02:40 PM


All times are GMT -5. The time now is 06:58 AM.

Main Menu
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