Hello there, was wondering if I could get some feedback on what the best approach to a particular use case I’ve got going on would be.
I’m starting to look into rewriting this little bash based Minecraft server manager I wrote years ago (and never finished) in python.
Background Info Not super important, but explains my thought process
The old implementation uses the screen program extensively to spin up server processes in a way that they are not child processes of the original script and also still able to be attached to if needed.
I’ve found this implementation with screen to be rather clunky, and that it conflicts a little with how the terminal works with minecraft servers (for example, I can’t scroll in the terminal. It instead seems to send up arrow key inputs).
Not to mention I can’t even begin to yet again wrap my head around the bash syntax. I don’t remember much about when I developed my original bash script but what I do remember was me and a buddy sitting in a discord call for two nights straight bashing out heads against a wall figuring out the syntax. I don’t want to deal with that again, hence my desire to try this over in python.
I’ve decided I do not want to rely on an external library to manage interacting with the java processes anymore, and that I want to get my hands a little dirty and manage reading their output and sending input to them myself.
However, I’m not comfortable with the idea of the java processes being children of the python process. My idea is to spin up the java servers as background processes, directing their console output to some sort of temporary file (either in the server’s main directory, or in a temporary file in /var/tmp
). Then I can simply run the python script whenever I need to start/stop a server, read console output, or send console commands.
I want to approach it this way because I want to make it easy for me or my friends to ssh into my server, run a script, and just be able to perform whatever action is needed. No having to load a background process or screen session to get to an already running python script. To me this seems like the simplest and easiest way, though that could be from simply naivety.
What I’ve found so far and what led me to post here
I’ve found this stack overflow post detailing a lot of different methods to potentially achieve what I have in mind, though the answers cover many years and many different approaches. I was wondering if anyone here might be able to give me some guidance as to what rabbit hole of learning I should start with considering my use case. Since it seems there is several ways of skinning this cat and I’m not really sure where to start.
To Summarize
I’m stuck in some analysis paralysis unsure of how/where I should direct my efforts on this adventure. I’m familiar with python and java, but threading, sub-processes, etc. is a realm I’m wholly unfamiliar with, and would like some help getting pointed in the right direction or (if applicable) why my dreamed up approach is misguided.
Thank you in advance to anyone who might be willing to help me out (=