update-rc.d and init.d dependencies

 ̄綄美尐妖づ 提交于 2019-12-03 15:10:34
Andrew_1510

To make your script run later in the boot sequence, just add a sequence number, like 98 in the following command. Then most dependencies will be satisfied.

Once, I had to use a boot script which depended on other boot scripts. This brought a lot troubles. In the end I used this command to solve the problem:

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

The 98 means my_script gets sequence number 98 at boot, it looks like it's range from 1 to 99, and most other boot scripts have smaller numbers, this ensures my script has all its dependencies ready.

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.

This approach doesn't work anymore on some systems (Debian Squeeze for example). The number is just ignored with no explanation. The preferred method is this: http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html

Look at "Required-Start:" script declaration.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!