Still having this issue. I notice that my systemd service is running both ExecStart and ExecStop commands sequentially when I run "systemctl start minecraft.service". I have verified this from the output from the tmux console and the systemd status as seen below. So it is properly calling the mc_server.sh script, but I can't get it to stop calling the "ExecStop" command. I've tried removing the Type= setting (making it simple by default), directly changing Type to simple, but none of these seem to fix the problem.
I recently upgraded to 18.04.1 and am having trouble getting my Minecraft systemd service working again. I did a clean install of 18.04 from 16.04. This service was working properly on 16.04, but now it doesn't seem to work. When I run "systemctl start minecraft.service" it seems to run the ExecStart script and the ExecStop script together based on the status output below, but I do not see any output from the scripts in my tmux console that it should be running through. If I call the startup script manually, it works fine, so something is wrong in the systemd service.
The service is set to run as the minecraft user under minecraft group. Everything in /srv/minecraft is owned by minecraft user/group. The minecraft.service file is owned by root. All of this is the same as it was in 16.04 when it was working. Please let me know if you have any ideas to get it running again! Thanks!!
:/etc/systemd/system$ systemctl status minecraft.service ● minecraft.service - Minecraft Server Loaded: loaded (/etc/systemd/system/minecraft.service; enabled; vendor preset Active: inactive (dead) since Wed 2018-11-14 16:33:25 PST; 3s ago Process: 4667 ExecStop=/srv/minecraft/mc_server.sh stop (code=exited, status=0/SUCCESS) Process: 4651 ExecStart=/srv/minecraft/mc_server.sh start (code=exited, status=0/SUCCESS) Nov 14 16:33:11 systemd: Starting Minecraft Server... Nov 14 16:33:11 mc_server.sh: Session found. Connecting. Nov 14 16:33:11 mc_server.sh: Minecraft server successfully started Nov 14 16:33:11 mc_server.sh: step 1 successs Nov 14 16:33:19 mc_server.sh: step 2 success Nov 14 16:33:21 mc_server.sh: server shutdown success Nov 14 16:33:25 systemd: Started Minecraft Server.
Here is the systemd script:
# Source: https://github.com/agowa338/MinecraftSystemdUnit/ # License: MIT [Unit] Description=Minecraft Server After=network.target auditd.service [Service] WorkingDirectory=/srv/minecraft/ # PrivateUsers=true User=minecraft Group=minecraft ProtectSystem=full ProtectHome=true # ProtectKernelTunables=true # Implies MountFlags=slave # ProtectKernelModules=true # Implies NoNewPrivileges=yes # ProtectControlGroups=true # Implies MountAPIVFS=yes Type=forking ExecStart=/srv/minecraft/mc_server.sh start ExecStop=/srv/minecraft/mc_server.sh stop Restart=on-abnormal RestartSec=60s [Install] WantedBy=multi-user.target