Issue
I am running some minecraft servers on a debian 9 based machine. These different servers are running on some screens.
I have made a backup script that I planned with cron tab but my problem is I wish to inject a command on the minecraft server's console doing "say Running backup, lag expected.". The thing is I am getting in trouble trying to run a command on a running detached screen.
I tried something adding in my script something like that:
screen -d -r mcprivate -X stuff "say hello world"
screen -d mcprivate
But this just reattach the screen and open it. It doesn't execute the command and doesn't execute the say injected command, it just stop the script after the reattach screen command.
So my question is : Is there a way to minecraft server command on a running screen?
Solution
So, i finally troubled it alone.
First, I don't know why but it looks like when command screen -r mcprivate -X stuff "say hello world"
it reattach and deattach the screen automatically. So the second line of my code wasn't even necessary. And to avoid loopinjection of "say hello world" I did just add a \n char at the end.
Answered By - Antoine Bonal Answer Checked By - David Marino (WPSolving Volunteer)