linux update-rc.d笔记

简介

  • Ubuntu或者Debian系统中update-rc.d命令,是用来更新系统启动项的脚本。这些脚本的链接位于/etc/rcN.d/目录,对应脚本位于/etc/init.d/目录。
  • /etc/rcN.d,N代表就是0-6和S级别的runlevel,即rc0.d表示runlevel为0的开机自动启动,以此类推
  • 关于runlevel

命令参数

$ update-rc.d --help
usage: update-rc.d [-n] [-f]  remove
       update-rc.d [-n]  defaults [NN | SS KK]         // NN SS KK是00-99
       update-rc.d [-n]  start|stop NN runlvl [runlvl] [...] .  // 这里有句点符号,别忘记了
       update-rc.d [-n]  disable|enable [S|2|3|4|5]
        -n: not really   //不理解,not readlly不完全?不完全删除?
        -f: force        //强制删除符号链接,即使/etc/init.d/仍然存在

The disable|enable API is not stable and might change in the future.

使用方法

$ update-rc.d -f  remove         // 删除在所有级别中的开机自动启动
$ update-rc.d  start 20 2 3 4 5 . stop 20 0 1 6 .
// 上面表示,在runlevel 2,3,4,5的时候第20个启动,在runlevel 0,1,6的时候第20个停止
// 别忘记上面的两个句点符号
$ update-rc.d  defaults           // 与上方相同效果
$ update-rc.d  defaults 80 20 // 表示默认级别下是第80个启动,第20个停止

你可能感兴趣的:(linux update-rc.d笔记)