linux启动之后处于某个状态
0:关机 #设置即重启
1:单用户,为root权限,禁止远程登录
2:无网络文本模式
3:多用户文本模式
4:未使用
5:图形化模式
6:重启 #设置即重启
用于检查和设置系统各种服务
chkconfig --list #列出所有系统服务的运行级别
chkconfig --list 服务名 #列出此服务的运行级别
chkconfig 服务名 on #设置服务在各个等级为on,及2.3.4.5
chconfig 服务名 off #关闭设置服务在各个等级为2.3.4.5
chkconfig --add 服务名 #添加某一个服务到系统服务中
--del
6版本服务脚本放置路径:
/etc/init.d/
- 1.在/etc/init.d/目录下编写服务脚本
- 2.给服务脚本赋予执行权限:
- chmod +x /etc/init.d/*
- 3.添加到系统服务中:
- chkconfig --add 服务名
systemd相关文件:
/usr/lib/systemd/system/ #rpm安装时分发的unit文件
/run/systemd/system/ #systemd运行时创建的文件
/etc/systemd/system/ #systemctl enable 创建的units文件(开机自启)