Linux开机启动,启动 mysql,log,web service 等,将执行脚本的命令放置在 /etc/rc.d/rc.local 中,系统启动之后自动执行。
比如在 rc.local 增加一行 /web/server/nginx, 用于启动 nginx 服务。
Linux启动步骤
- 加载BIOS
- 读取MBR
- Boot Loader / Grup
- 加载内核
- 用户层init依据inittab文件来设定运行等级
- init进程执行rc.sysinit
- 启动内核模块
- 执行不同运行级别的脚本程序(/etc/rc.d/rc $RUNLEVEL # $RUNLEVEL为缺省的运行模式 )
- 执行/etc/rc.d/rc.local(初始化完成后执行 rc.local 中的命令)
- 执行/bin/login程序,进入登录状态