gekware / minecraft-server-hibernation

Autostart and stop minecraft-server when players join/leave
GNU General Public License v3.0
377 stars 36 forks source link

[Feature Request] - named pipe support #279

Open red-daut opened 5 months ago

red-daut commented 5 months ago

Is there an existing feature request for this?

Describe the feature you would like to see.

Add the ability to read in from a named pipe to allow for sending commands to the MSH console through scripting.

Describe the solution you'd like.

When I try to send commands from my bash script to the MSH console, the response from MSH is [warn ≡≡≡ ] GetInput: stdin unavailable, exiting input goroutine [07f102] - Since stdin is unavailable, adding named pipe support that reads into MSH would allow sending commands to MSH from scripts.

Additional context to this request.

I am creating an egg in Pterodactyl which uses MSH. Once the eula has been accepted as part of the installation process (through the Pterodactyl prompt or manual creation of the eula.txt file) the server needs to be restarted before anyone can join.

I am attempting to automate this restart (of MSH) through the scripting in the egg I am creating. In my script, I am able to use the awk command to look for the console output listening for new clients connections from MSH and then send a system command such as msh exit. Upon this exit, Pterodactyl will automatically restart the server.

The problem is my script can't send commands to MSH due to stdin being unavailable. Adding support for a named pipe to MSH will solve this problem.

Once this issue is solved, it would mean the server would be ready to join, using MSH, without any end user manual intervention.