swalloich
swalloich
AAdmincraft
Created by swalloich on 6/14/2024 in #questions
Starting and stopping a headless server using Systemd service
I'm running a fabric server on an Oracle cloud vm running oracle linux. The server is managed by a daemon user and a systemd service. I can start the server fine using sudo systemctl start minecraft-server, but when I stop, it gives me an error in the log:
stop.sh: Error: connection failed (localhost).
systemd: minecraft-server.service: Control process exited, code=exited status=255
systemd: minecraft-server.service: Failed with result 'exit-code'
stop.sh: Error: connection failed (localhost).
systemd: minecraft-server.service: Control process exited, code=exited status=255
systemd: minecraft-server.service: Failed with result 'exit-code'
It then proceeds to stop, despite the error implying that it couldn't. My server starts by running the command: java -Xmx6G -jar fabric-server.jar nogui in a bash script called start.sh. It is stopped by running <absolute_path>/mcrcon -c -H localhost -P <port> -p $RCON_PASSWORD stop in a bash script called stop.sh. Is there a more graceful way to start and stop the server that I'm not aware of? EDIT: Turns out the server does not stop. The log says it does, but the process is still running in the background.
8 replies