Linux 启动配置项
来源:互联网 发布:c 网页中数据写入xml 编辑:程序博客网 时间:2024/06/02 07:28
init.d/ :各种服务器和程序的二进制文件存放目录。
rcx.d/: 各个启动级别的执行程序连接目录。里头的东西都是指向init.d的一些软连接。
三个启动脚本:rc.sysinit, rc, rc.local
redhat的启动方式和执行次序是:
加载内核 执行init程序 /etc/rc.d/rc.sysinit # 由init执行的第一个脚本
/etc/rc.d/rc $RUNLEVEL # $RUNLEVEL为缺省的运行模式
/etc/rc.d/rc.local /sbin/mingetty # 等待用户登录
/etc/rc.d/rc.sysinit主要做在各个运行模式中相同的初始化工作,包括: 调入keymap以及系统字体 启动swapping 设置主机名 设置NIS域名 检查(fsck)并mount文件系统 打开quota 装载声卡模块 设置系统时钟 等等。
/etc/rc.d/rc则根据其参数指定的运行模式(运行级别,你在inittab文件中可以设置)来执行相应目录下的脚本。
凡是以Kxx开头的 ,都以stop为参数来调用;凡是以Sxx开头的,都以start为参数来调用。调用的顺序按xx 从小到大来执行。
例如,假设缺省的运行模式是3,/etc/rc.d/rc就会按上述方式调用 /etc/rc.d/rc3.d/下的脚本。
值得一提的是,Redhat中的运行模式2、3、5都把/etc/rc.d/rc.local做为初始化脚本中 的最后一个,所以用户可以自己在这个文件中添加一些需要在其他初始化工作之后,登录之前执行的命令。 init在等待/etc/rc.d/rc执行完毕之后(因为在/etc/inittab中/etc/rc.d/rc的 action是wait),将在指定的各个虚拟终端上运行/sbin/mingetty,等待用户的登录。
Fedora 设置开机启动脚本
sudo touch /etc/rc.d/rc.local
sudo vim /etc/rc.d/rc.local
在/etc/rc.d/rc.local文件中写入, 然后使用:wq命令 保存并退出.
#!/bin/bash
# 在这个文件中写入开机启动需要执行的命令
赋予可执行权限:
sudo chmod+x /etc/rc.d/rc.local
设置开机启动:
sudo systemctl enable rc-local.service
如果出现以下错误提示:
[root@dev-zhanghua ~]# systemctl enable rc-local.service
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
sudo vim /usr/lib/systemd/system/rc-local.service
在rc-local.service文件末尾加入:
[Install]
WantedBy=multi-user.target
并重新设置开机启动:
sudo systemctl enable rc-local.service
重启计算机,完成!
reboot
注:转载(本文稍有改动)
- linux 启动项配置
- Linux 启动配置项
- Linux配置启动项,自启动服务
- linux mysql 启动 停止 启动项配置
- Linux配置启动项,自启动服务
- Linux配置启动项,自启动服务
- Linux启动项的管理和配置
- 【Linux】启动模式配置
- linux开机启动配置
- Linux启动+服务配置
- Linux 修改启动配置
- linux启动过程,及开机启动项的配置
- CentOS Linux 启动GRUB配置
- linux配置多内核启动
- 配置Grub以便启动Linux
- 配置Linux 开机启动服务
- 如何修改linux启动配置
- linux redis 开启启动配置
- 如何彻底修改eclipse项目的名称
- MyEclipse WebSphere开发教程:安装和更新WebSphere 6.1, JAX-WS, EJB 3.0(七)
- 台大-林轩田老师-机器学习基石学习笔记5
- 使用django的记录(一)
- Centos更改Docker默认网关
- Linux 启动配置项
- Spring Security--概念概览
- apicloud菜鸟问题
- 不看后悔flyerinternational揭秘同行骗子伎俩
- mac 系统使用 psutil 模块获取系统 cpu,内存等信息
- 理解ResNet结构与TensorFlow代码分析
- Java Excel 通用导入
- 在android手机端查看APP的本地数据库
- 1 让自己习惯C++