经过一番研究后,我确定 - 我可能是错的,因为我对这些问题的了解相当粗略 -/etc/init.d 中的脚本按照/etc/中的符号链接(symbolic link)确定的顺序运行rcN.d.
我不太清楚为什么在 Ubuntu 14.10 上有一整套 rcN.d 文件夹,其中 N 从 0 运行到 5。 runlevel 表示当前运行级别是 N 2。 d 我有文件
s01rsyslog s02memcached ... so3grub-common
我认为这表明 s01 脚本将先于 s02 脚本等运行。
现在这是我需要做的 - 在完成其他操作之后在 init.d 中运行我自己的脚本。在尝试之前,我想确定这是否是正确的做法
- 创建脚本
- chmod +x 它
- 在/etc/rc2.d 中创建指向它的符号链接(symbolic link)
- 用 s04 符号链接(symbolic link)的名称...
我将非常感谢任何能够确认这是正确的做事方式的人
最佳答案
我终于找到了我需要的有关运行级别等的所有信息 here 。希望这对遇到这个问题的其他人有用。引用其中解释的基本内容
Simply put, a 'runlevel' determines which programs are executed at system startup. Most of your exposure to run levels will deal with system startup. You will become intimately familiar with the exceptions the first time you have to troubleshoot a failed system.
Linux run levels are numbered 0 through 6. Run levels stop at six for practical and historical reasons, but it is entirely possible to have more if desired.
各种运行级别的简要说明:
- 0 系统停止
- 1 个单用户
- 2 完整多用户模式(默认)
- 3-5 与 2 相同
- 6 系统重启
关于ubuntu -/etc/init.d 的执行顺序以及它与/etc/rc.d 的关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28772350/