I'll try to explain as much as I can my issue. So I have an Ubuntu machine set up which I use to host my Minecraft Server. It uses Java 8. To start it, I usually use the command java -Xmx10G -jar server.jar nogui. But as I am going on vacation and my friends still want to sometimes play on it, I wanted to make an option to start it without having to enter this command. I created a .sh file, put it as crontask and put this in it :
nohup sudo java -Xmx10G -jar server.jar nogui >> minecraft_logs.txt &
This line works fine, and my server is running in background, printing its output in "minecraft_logs.txt". However, I realized I couldn't have access to its console anymore. I however wanted to be able to send commands on it (inputs), such as tellraws or give commands.
How could I "inject" commands into my Minecraft Server task running in the background ? Thank you.
I tried using screen or using this syntax : nohup sudo java -Xmx10G -jar server.jar nogui < input.txt >> minecraft_logs.txt & but it didn't work at all (or maybe I didn't get it to work). I couldn't find anything that worked for me.