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.