I have some services in my init.d folder for e.g. hdfs, zookeeper, elasticsearch, hbase and so on.

Now, I have added all those services to startup by doing the update-rc.d 'service' defaults command. As we know, hbase can't run if hdfs and zookeeper are not started. So I want to start hdfs first, then zookeeper and then finally hbase.

how do I do this?

  • 1
    Possible duplicate of Order in startup application preferences
    – Parto
    Apr 5, 2016 at 5:57
  • @Parto - It still does not answer my question properly. I don't want to add delays. I want to specify an order. So its not a duplicate.
    – Punit Naik
    Apr 5, 2016 at 6:15
  • Then this one: askubuntu.com/questions/49274/…
    – Parto
    Apr 5, 2016 at 6:29
  • You should consider migrating these from sysv init scripts to Upstart services. Then you can say: start on started hdfs for zookeeper and start on started zookeeper for hbase, etc.
    – muru
    Apr 5, 2016 at 6:49
  • @muru - Yeah. Will consider that.
    – Punit Naik
    Apr 5, 2016 at 6:52

2 Answers 2


update-rc.d(8) enables or disables services, while the ordering of services is handled by insserv(8), and can be customized by editing the LSB header of the service and setting/adding:

Required-Start: $all

In oldest versions, i can do something like this to determine the order:

update-rc.d myservice start 95 2 3 4 5 . stop 70 0 1 6 .

But after Ubuntu 14, i tried this Ubuntu 16.04 (4.4.0-31-generic):

update-rc.d myservice defaults 95 70

And doesn't work, always creates the order defined in the header:

 sudo find /etc/ -name ???myservice | sort

Also al try:

update-rc.d myservice defaults any_text_wath_you_want lalala

Ands seems like ignores all the text after "defaults". I don´t know wath it do when my installation order, I do not think that orders previously installed services.


You can do it by update-rc.d 'service' defaults number where the number is an integer and the lesser the sequence number, the higher the service in the queue i.e it will be executed before other services with a greater sequence number.

The above command will give the same priority for starting as well as killing the service. You can fine tune it further.

So if you have a service which has a lot of dependencies, you can give it a large sequence number to ensure that all of its dependiencies have booted up before it starts itself.


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.