Update-rc.d and init.d

So, I'm trying to write some init.d scripts that satisfy LSB, so they run properly when starting and shutting down. Unfortunately, I am having problems with LSB / update-rc.d to satisfy dependencies.

# Required-Start: $network $local_fs hadoop-namenode hadoop-datanode zookeeper-server # Required-Stop: $network $local_fs hadoop-namenode hadoop-datanode zookeeper-server # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 

however, when I run the update-rc.d default values, it simply generates the default values ​​with the same start time as the already dependent ones, which greatly violates the situation. Did I miss something with update-rc.d or LSB to configure this?

In case this is appropriate, this is Ubuntu 12.04

+7
source share
2 answers

To make your script run later in the boot sequence, simply add a sequence number, such as 98 in the following command. Then most of the dependencies will be fulfilled.

I once had to use a loading script that depended on other loading scripts. This brought a lot of trouble. In the end, I used this command to solve the problem:

 cd /etc/init.d sudo update-rc.d my_script defaults 98 

98 means my_script gets serial number 98 when loading, it looks like it ranges from 1 to 99, and most other loading scripts have lower numbers, this ensures that my script has all its dependencies.

BTW, to remove the old script, this can be used:

 sudo update-rc.d -f my_old_script remove # -f means 'force' 

Hope this helps.

+12
source

This approach no longer works on some systems (e.g. Debian Squeeze). The number is simply ignored without explanation. Preferred Method: http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html

Take a look at the β€œRequired-Start:” script ad.

+7
source

All Articles