I am trying to have a minecraft server auto start on a screen after the server reboot. Currently using CentOS 7. Here's my minecraft.service i put in systemd.
[Unit] Description=Start Minecraft After=network.target [Service] Type=simple ExecStart=/root/start_minecraft_server.bash TimeoutStartSec=0 [Install] WantedBy=default.target
And here's my bash that ExecStart calls
#!/bin/bash screen -d -m -S minecraft java -Xmx1536M -Xms1536M -jar minecraft_server.1.13.2_carpet.jar nogui echo hi
the echo is just to test if it's working, and i do get a hi if i do
#systemctl status minecraft.service
However, no screen is setup on startup. When i manually run the bash, it does run the minecraft server correctly in a different screen.
If i remove the screen part of the bash and just do
exec java -Xmx1536M -Xms1536M -jar minecraft_server.1.13.2_carpet.jar nogui in my bash file, it also works, just doesn't give me a screen so i have no access to the minecraft server console.