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 ...
随机推荐
- 第十四章 springboot + profile(不同环境读取不同配置)
具体做法: 不同环境的配置设置一个配置文件,例如:dev环境下的配置配置在application-dev.properties中:prod环境下的配置配置在application-prod.prope ...
- C/C++中printf/cout 计算顺序与缓冲区问题
1.printf/cout在同一个语句中都是从右向左计算的. 看如下的代码: #include <stdio.h> int main() { ; printf("%d %d&qu ...
- Android组件之Service浅谈
Service是Android中的四大组件之一,和windows中的服务是类似,服务一般没有用户操作界面,它运行于系统中不容易被用户发觉,可以使用它开发如监控之类的程序Service,手机中有的程序的 ...
- HTTP响应状态码【总结】
常见的状态码 [1XX]表示[消息] [2XX]表示[成功] [3XX]表示[重定向] [4XX]表示[请求错误] [5XX]表示[服务器端错误] 200:OK.请求被正常处理 204:No Cont ...
- 两个JS对象怎样才能相等
在JS中,两个对象如何才能相等?下面的两个 Alert,只有一个输出true. 在JS中如何才能构造出两个JS对象相等? var prop1 = {asd:{def:'abc'}}; var pro ...
- 利用CSS、JavaScript及Ajax实现图片预加载的三大方法及优缺点分析
预加载图片是提高用户体验的一个很好方法.图片预先加载到浏览器中,访问者便可顺利地在你的网站上冲浪,并享受到极快的加载速度.这对图片画廊及图片占据很大比例的网站来说十分有利,它保证了图片快速.无缝地发布 ...
- 说一说activity
activity与service,provider,receiver并称为 android的四大对象. 而activity,是展现界面的必不可少的组件.我这里有几个问题要问了,他是如何加载,他是如何进 ...
- spark streaming的理解和应用
1.Spark Streaming简介 官方网站解释:http://spark.apache.org/docs/latest/streaming-programming-guide.html 该博客转 ...
- ListView 拖拽
private void ListView1_MouseMove(object sender, MouseEventArgs e) { Patientappointment appointment = ...
- linux ---jenkins的安装与配置
linux下的jenkins的安装: Jenkins 下载网址: http://jenkins-ci.org/ 1.准备:JDK环境,tomcat环境,maven环境,jenkins.war包 2.在 ...