Server activation help

Hello GitHub,

I recently created a minecraft server for my son

He would like his friends to be able to activate it while he is not around

For those who don’t know, activation is a batch file

Is there any way that his friends would be able to remotly activate it, but _only _be able to that, no file snooping, etc and it be safe and secure?

I was going to suggest something complex with remote terminal login, locked accounts, etc, but had a better idea.

You might try a simple web server, where sending a command to your web server causes the Minecraft server to be activated.

 This gist is a good example of a simple web server using python. You’ll fire that off, listening on your ip address and a port of your choice. You may have to allow the port via your firewall or ask your ISP which ports you can use.

In the python code, entitled “do_POST”, use 

subprocess.run

to execute your minecraft server batch file. E.g.:

def do_POST(self):
        subprocess.run(["start", " ", "your-batch-file.bat"])

[Using ‘start’ is necessary to run the batch file on its own without blocking. If I have it correct …]

So the minecraft batch file executes when one of your son’s friends runs the appropriate curl command:

curl -d "minecraft" http://123.456.789.123:8080

where the ip address of your web server replaces 123.456.789.123 and 8080 replaced by the port the webserver is listening on.

I hope that wasn’t complete gibberish … or completely off-base!

2 Likes

Thank you so much

Will try when I get time

com.mojang.authlib.GameProfile@6df625ed[id=<null>,name=snoumi,properties={},legacy=false] (/192.168.100.7:56645) lost connection: Disconnected.please help me.thank you.