Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

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?

 

2 Replies
Highlighted
Commander Lvl 2
Message 2 of 3

Re: Server activation help

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!

 

Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!

Copilot Lvl 2
Message 3 of 3

Re: Server activation help

Thank you so much

Will try when I get time