linux 设置开机启动项

Linux的启动流程

这里写图片描述
主要顺序就是:
1. 加载内核
2. 启动初始化进程
3. 确定运行级别
4. 加载开机启动程序
5. 用户登录
6. 启动流程的具体细节可以看看Linux 的启动流程

第4步加载启动程序其实是两步:

init进程逐一加载开机启动程序,其实就是运行指定目录里的启动脚本。
在运行完指定目录里面的程序后init进程还会去执行/etc/rc.local 这个脚本。
ps:“指定目录”是指在第3步中设置的运行级别对应的目录。

下面是添加启动项的集中方法

1.chkconfig

2.修改/etc/rc.local脚本

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
......
......

linux 设置开机启动项两种方式
https://blog.csdn.net/karchar/article/details/52489572
linux开机自启动的几种方法:
https://blog.csdn.net/Aggressive_snail/article/details/50640187

猜你喜欢

转载自blog.csdn.net/u010758410/article/details/80660264