1

As far as I understand the shutdown command: If I send a shutdown -h now init will try and stop all processes gracefully, wait a certain amount of time, then send kill -9.

My question is: how long will init wait, and how do I configure this length of time? I have a mysql server that can take up to 15 minutes to stop gracefully, and I want to be sure that init doesn't try and kill -9 it.

From reading the man page, at first glance it looks like the -t flag is what I'm looking for, however, reading in a bit more detail this flag actually specifies the delay between sending the shutdown command and init trying to stop all processes gracefully.

OS is CentOS 6, but interested in Debian 7 as well.

  • I don't have a citation (thus a comment, rather than an answer), but I believe this is not configurable by design. Well behaved processes should not take 15 minutes to terminate upon being instructed to do so. Perhaps your database is misconfigured or overloaded? – dimo414 May 6 '16 at 6:21
1

You can specify the time after which you need to shutdown as mentioned here.

shutdown -h +15 "Waiting for graceful shutdown of mysql server"

EDIT

I used the below script in one of the machines to check if the script is getting killed.

while true; do sleep 999999; done

The process was not killed and it was there.

  • As your link clearly states, -h specifies "when to shutdown", not the delay between kill and kill -9. – dimo414 May 6 '16 at 6:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.