[Unit] Description={{ domain }} Minecraft Server Wants=network.target After=network.target [Service] User={{ system_user }} Group={{ system_user }} Nice=2 KillMode=none SuccessExitStatus=0 1 ProtectHome=true ProtectSystem=full PrivateDevices=true NoNewPrivileges=true PrivateTmp=true InaccessibleDirectories=/root /sys /srv -/opt /media -/lost+found ReadOnlyDirectories={{ installation_directory }} ReadWriteDirectories={{ data_directory }} WorkingDirectory={{ data_directory }} ExecStart={{ launch_script }} ExecStop={{ remote_control_script }} "say Server will be restarted in 5 seconds" ExecStop=/usr/bin/sleep 5 ExecStop={{ remote_control_script }} stop ExecStop=/bin/bash -c "while ps -p $MAINPID > /dev/null; do /bin/sleep 1; done" [Install] WantedBy=multi-user.target