Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to hook some script to shutting down sequence for Linux?

To give you a bit more context processes of nodes of the cluster are started as processes from cluster -master. They are not running as services. However if someone restart a node and didn't stop the appropriate process manually, it causes a troubles because the node hasn't been stopped gracefully.

I would like to avoid this situation. Processes they don't run as services.

share|improve this question

I'd link a script that would shut down the nodes to /etc/rc6.d

It'll run on runlevel 6, that coresponds to shutdown sequence. Link name should be of format KXXName, where XX is a sequence number.

I'm assuming here that you have control over the nodes and you are able to wait for them to shut down gracefully.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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