RHEL7 -- systemd
systemd 在RHEL7中,进程ID 1属于systemd这个新的进程。(代替之前版本中的init)
systemd提供了以下新功能:
·并行化功能,可以提高系统的启动速度
·按需启动守护进程,而不需要单独的服务
·自动服务依赖关系管理,可以防止长时间超时,例如在网络不可用时不启动网络服务
·利用linux控制组一起追踪相关进程
有了systmed以后,基于shell的服务脚本基本仅用于几个传统服务。因此,带有shell变量的配置文件将被取代,如/etc/sysconfig中可以找到的配置文件。 仍然在使用的配置文件作为systemd环境文件被纳入,并作为NAME=VALUE对进行读取。他们不再以shell脚本的形式提供。
systemctl和systemd单元
systemctl命令管理各种类型systemd对象,他们称为单元。可以通过systemctl -t help命令显示可用单元类型的列表
# systemctl -t help
Available unit types:
service
socket
target
device
mount
automount
snapshot
timer
swap
path
slice
scope
-服务单元具有.service扩展名,代表系统服务
-套接字单元具有.socket扩展名,代表进程间通信套接字
-路径单元具有.path扩展名,用于将服务的激活推迟到特定文件系统更改发生之后。
查看服务状态:
使用systemctl status name.type查看服务状态(取代了旧版中的service NAME status命令 )
[root@rhce7 ~]# systemctl status network.service
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)
Active: active (exited) since Thu -- :: CST; 1h 22min ago
Process: ExecStart=/etc/rc.d/init.d/network start (code=exited, status=/SUCCESS) Jul :: rhce7.example.com systemd[]: Starting LSB: Bring up/down networking...
Jul :: rhce7.example.com network[]: Bringing up loopback interface: Could not load file '/etc/sysconfig/networ...fg-lo'
Jul :: rhce7.example.com network[]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Jul :: rhce7.example.com network[]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Jul :: rhce7.example.com network[]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Jul :: rhce7.example.com network[]: [ OK ]
Jul :: rhce7.example.com network[]: Bringing up interface Profile_1: [ OK ]
Jul :: rhce7.example.com network[]: Bringing up interface enp0s17: [ OK ]
Jul :: rhce7.example.com network[]: Bringing up interface enp0s8: [ OK ]
Jul :: rhce7.example.com systemd[]: Started LSB: Bring up/down networking.
Hint: Some lines were ellipsized, use -l to show in full.
[root@rhce7 ~]#
如果没有指定type,即未提供单元类型,则systemctl将显示服务单元的状态(如果存在)
[root@rhce7 ~]# systemctl status session-
session-.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead) [root@rhce7 ~]# systemctl status session-.scope
session-.scope - Session of user root
Loaded: loaded (/run/systemd/system/session-.scope; static)
Drop-In: /run/systemd/system/session-.scope.d
└─-After-systemd-logind\x2eservice.conf, -After-systemd-user-sessions\x2eservice.conf, -Description.conf, -SendSIGHUP.conf, -Slice.conf
Active: active (running) since Thu -- :: CST; 1h 5min ago
CGroup: /user.slice/user-.slice/session-.scope
├─ sshd: root@pts/
├─ -bash
└─ systemctl status session-.scope Jul :: rhce7.example.com systemd[]: Starting Session of user root.
Jul :: rhce7.example.com systemd[]: Started Session of user root.
Jul :: rhce7.example.com sshd[]: pam_unix(sshd:session): session opened for user root by (uid=)
[root@rhce7 ~]# systemctl status network
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)
Active: active (exited) since Thu -- :: CST; 1h 25min ago
Process: ExecStart=/etc/rc.d/init.d/network start (code=exited, status=/SUCCESS) Jul :: rhce7.example.com systemd[]: Starting LSB: Bring up/down networking...
Jul :: rhce7.example.com network[]: Bringing up loopback interface: Could not load file '/etc/sysconfig/networ...fg-lo'
Jul :: rhce7.example.com network[]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Jul :: rhce7.example.com network[]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Jul :: rhce7.example.com network[]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Jul :: rhce7.example.com network[]: [ OK ]
Jul :: rhce7.example.com network[]: Bringing up interface Profile_1: [ OK ]
Jul :: rhce7.example.com network[]: Bringing up interface enp0s17: [ OK ]
Jul :: rhce7.example.com network[]: Bringing up interface enp0s8: [ OK ]
Jul :: rhce7.example.com systemd[]: Started LSB: Bring up/down networking.
Hint: Some lines were ellipsized, use -l to show in full.
[root@rhce7 ~]#
服务状态表示的关键字说明
| 关键字 | 说明 |
| loaded | 单元配置文件已经处理 |
| active(running) | 正在通过一个或多个持续进程运行 |
| active(exited) | 已成功文成一次性配置 |
| active(waiting) | 运行中,正在等待事件 |
| inactive | 不在运行 |
| enabled | 开机自启动 |
| disabled | 开机不会自启动 |
| static | 无法启用,但可以由某一启动的单元自动启动 |
RHEL7 -- systemd的更多相关文章
- CentOS7进程管理systemd详解
概述: 系统启动过程中,当内核启动完成,后加载根文件系统,后就绪的一些用户空间的服务的管理工作,就交由init进行启动和管理,在CentOS6之前的init的管理方式都类似,相关的内容我们在之前的 ...
- cetos7 systemd 详解
CentOS7/RHEL7 systemd详解 目录1. 为什么是systemd(1) 关于Linux服务管理(2) SysV init的优缺点(3) UpStart的改进(4) systemd的 ...
- CentOS7关闭防火墙方法
在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# ...
- RedHat Enterprise Linux 7关闭防火墙方法
systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起 在之前的版本中关闭防火墙等服务的命令是 service iptables stop ...
- Linux 相关基础笔记
html,body { } .CodeMirror { height: auto } .CodeMirror-scroll { } .CodeMirror-lines { padding: 4px 0 ...
- CentOS 7 service systemnctl
在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# ...
- /etc/rc.d/init.d/iptables: No such file or directory 错误原因
注:本文转载自cnblogs:一天学点的文章</etc/rc.d/init.d/iptables: No such file or directory 错误原因> RedHat Enter ...
- 1安装Linux
第二天笔记打卡. 系统安装注意:1.DATE&TIME2.Server with GUI3.分区默认4.网络开启 源代码安装:1.安装难度高2.编译环境复杂3.解决依赖关系 源代码:2.部署编 ...
- ZooKeeper单机伪集群搭建与启动
下载解压 [xiaobai@xiaobai ~]$ tar -zvxf zookeeper-3.4.9.tar.gz 本机ip地址映射 [xiaobai@xiaobai /]$ su - rootPa ...
随机推荐
- C# 中使用 RSA加解密算法
一.什么是RSA RSA公开密钥密码体制.所谓的公开密钥密码体制就是使用不同的加密密钥与解密密钥,是一种“由已知加密密钥推导出解密密钥在计算上是不可行的”密码体制. 在公开密钥密码体制中,加密密钥(即 ...
- android 时间控件概述
android的自带时间选择控件,是一个让用户既能输入的又能选择的样子.这本来没有太大的问题了. 但是,坑爹的android是开源的.自带的时间控件在某些机型上,早已经是面目全非了,在用以一个普通用户 ...
- Discuz常见小问题-网站如何备份和恢复
进入后台之后,点击UCenter,然后在左侧的数据备份中点击提交,大概一两分钟会显示备份完成 备份好的数据在uc_server的data/backup文件夹中(文件名为时间+随机字符,里面就一个数据库 ...
- 如何使用千千静听为MP3添加专辑封面和文字信息
使用千千静听播放器打开某MP3文件,右击该文件,选择属性. 2 点击专辑封面即可添加或更换专辑封面 点击保存到文件再点击重新读取文件即可发现有效了 3 为MP3批量添加添加封面 选中播放列表的所有文件 ...
- utc时间转换成标准时间
把这个时间 /Date(1484884647943+0800)/ 转成标准时间 String str = String.format("%tF %<tT", 14848846 ...
- 简单分页查询(web基础学习笔记十三)
一.建立资源文件和工具类 1.1 .database.properties jdbc.driver_class=oracle.jdbc.driver.OracleDriver jdbc.connect ...
- Windows安装MySQL解压版
1:解压 2:设置环境变量 3:修改my.ini [mysqld] basedir = D:\MySQL\Server\mysql--win32 datadir = D:\MySQL\Server\d ...
- 基于jquery的锚点滚动插件(百度百科效果) anchorScroll.js
1.插进使用场景 请打开https://baike.baidu.com/item/%E6%97%A5%E6%9C%AC%E5%8A%A8%E7%94%BB#hotspotmining,查看百度百科页面 ...
- 【docker】挂载web应用
现在将webapps目录挂载在宿主机目录,方便运维 docker run -p 8090:8080 --name app -v /usr/app:/usr/local/tomcat/webapps d ...
- def函数之另类用法
#python 27 #xiaodeng def list_opts(): return [ ('name', 'xiaodeng'), ('age', 28), ('), ('where', 'en ...