Start Minecraft Server on first Connection

I was wondering if it's possible to have my (Vanilla) Minecraft server not actually start running until someone tries to connect to it? I have full access to the entire server (It's an old computer of mine) and the router/internet. Failing that, how do I make a button on my nginx site to say "start the mc server"? I'm running Ubuntu 14.04
Best Answer
This is possible but you will need a small program listening on the game server's socket and if it receive any data it will then start the server. But the actual game server will need time to start, so the first login attempt on the client will fail as it will time out. When the server has start they will be able to login successfully. I don't know any existing program for that purpose but it wouldn't be that hard to develop.
Pictures about "Start Minecraft Server on first Connection"



How do I make my Minecraft server start automatically?
Setup Minecraft server to start automaticallyHow do I start an IP for my Minecraft server?
How to Set Up Your Minecraft ServerDo I need to port forward for Minecraft server?
Forwarding a port is necessary if you want to let people who aren't on your Wi-Fi network join a server that you're hosting, as it will allow traffic from outside your network to access your computer.How do you direct connect on Minecraft?
Open the regular Minecraft game, click Multiplayer, then click Direct Connect. You'll be entering an IP address here based on where you are relative to the server computer.How To Make A Minecraft 1.17.1 Server (Hosting Your Own Vanilla Server is EASY)
More answers regarding start Minecraft Server on first Connection
Answer 2
I guess you can't, but you could tell your friends the schedule of when the server is going online, or either just keep it online all day (If you don't mind wasting energy) except when you guys are sleeping. Another way is just buy a realm or host a server by an official site, then your server would be 24/7 without you really having to worry about it.
Answer 3
I think this is not possible from Minecraft, just because you cannot even ping offline server (in multiplayer menu), so how would you do some extra communication?
Probably the best solution would be to have some web application or SSH connection, where legit users of your server (so they know password or so) can connect and send to your computer some commands...with Ubuntu it could be not hard to allow usage of only one command / privileges to run only one file in exact folder -> starting script for server...then your players will just run it (and you have to not forget to implement safety check to do nothing if server runs already) and server will start in a minute.
However computer still needs to be online all the time, so why not keep MC server online, too? Server running without players has only quite low RAM usage and nearly none CPU usage...but no worries how to start it :P
Answer 4
Well, if you invite friends over to your server, you should ask them when they would like/can get on, and when that time comes, just start your server! I hoped that helped.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Andre Moura, Andres Ayrton, Brett Sayles, Nothing Ahead