Starting a minecraft server upon connection?
Seems possible using systemd
starting it only once and stopping it when the last player disconnects, this needs to be determined here... I suppose a preStart and postStop script looking if the server exists and has player may do the trick
did anyone do that before?
@solene And the unit file look like this in my case:
[Unit]
Description=Minecraft Server
After=local-fs.target network.target multi-user.target
[Service]
Type=simple
ExecStart=/home/minecraft/msh
KillMode=mixed
User=minecraft
Group=minecraft
TimeoutStopSec=120
TimeoutStartSec=180
WorkingDirectory=/home/minecraft
Nice=19
Sockets=minecraft-server.socket
StandardInput=socket
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
@solene (the socket is only there to send commands to the server directly in the console (from the standard input), instead of using RCON)
@solene don't worry someone else will come out eventually with systemd-Minecraft
@solene I’m using this : https://github.com/gekware/minecraft-server-hibernation
You can set it to start and stop the server, or to only suspend and resume the process.