4

I used the script here to create a service to start and stop a Minecraft server on boot and shutdown. The script basically starts the server jar file in a GNU screen (it also does backups and updates but they are working fine).

This starts the server fine but stops the server abruptly instead of sending a message on the server then using the /stop command to stop the server gracefully(as the script is meant to do and does do if sudo service minecraft stop is called while the system is still running).

I used sudo update-rc.d minecraft defaults 20 01 which should ensure the server is among the first processes to be stopped.

I can tell that this is working as the first four lines shown after a shutdown starts are:

[  OK  ] Stopped target Graphical Interface.
         Starting Unattended Upgrades...
[  OK  ] Stopped target Multi-User System
         Stopping LSB: Minecraft server...

There is then a bunch of Stopping and Stopped messages. The server abruptly stops during this period(the clients are all disconnected with no warning) and then this:

[******] A stop job is running for LSB: Minecraft server (17s / 5min)

with the seconds counting up until usually about 17 before the final few screens-full of messages before the system shuts down.

I'm assuming this means that the service is 'told' to stop early-on in the shutdown process but takes a while to do so(due to it sending an alert on the server, waiting, saving, etc) while the system is waiting for the script to do this, it stops other services which cause all the clients to be disconnected before the warning message is displayed. I have tried adding $network to Required-Stop to no avail.

What I need to do is make the service stop all at once without other services simultaneously stopping. How would I go about this?

I'm using Ubuntu 15.04 on a XenServer.

View the full shutdown log here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.