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的更多相关文章

  1. CentOS7进程管理systemd详解

      概述: 系统启动过程中,当内核启动完成,后加载根文件系统,后就绪的一些用户空间的服务的管理工作,就交由init进行启动和管理,在CentOS6之前的init的管理方式都类似,相关的内容我们在之前的 ...

  2. cetos7 systemd 详解

      CentOS7/RHEL7 systemd详解 目录1. 为什么是systemd(1) 关于Linux服务管理(2) SysV init的优缺点(3) UpStart的改进(4) systemd的 ...

  3. CentOS7关闭防火墙方法

    在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# ...

  4. RedHat Enterprise Linux 7关闭防火墙方法

    systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起 在之前的版本中关闭防火墙等服务的命令是 service iptables stop ...

  5. Linux 相关基础笔记

    html,body { } .CodeMirror { height: auto } .CodeMirror-scroll { } .CodeMirror-lines { padding: 4px 0 ...

  6. CentOS 7 service systemnctl

    在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# ...

  7. /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 ...

  8. 1安装Linux

    第二天笔记打卡. 系统安装注意:1.DATE&TIME2.Server with GUI3.分区默认4.网络开启 源代码安装:1.安装难度高2.编译环境复杂3.解决依赖关系 源代码:2.部署编 ...

  9. ZooKeeper单机伪集群搭建与启动

    下载解压 [xiaobai@xiaobai ~]$ tar -zvxf zookeeper-3.4.9.tar.gz 本机ip地址映射 [xiaobai@xiaobai /]$ su - rootPa ...

随机推荐

  1. zoj 2860 四边形优化dp

    Breaking Strings Time Limit: 2 Seconds        Memory Limit: 65536 KB A certain string-processing lan ...

  2. QtWebKit

    WekKit官网:http://www.webkit.org/ QtWebKit官网及安装:http://trac.webkit.org/wiki/QtWebKit#GettingInvolved Q ...

  3. mysql数据库查询优化

    上两周一直想办法提高查询速度,取得一点效果,解决了部分问题,记下来以便将来自己查看. 由于公司没有专门的DBA,我自己对mysql数据库也不是很熟悉,而且这个JAVA开发的网络审计系统的管理系统,是经 ...

  4. 获取定位,苹果IOS10以上不支持h5的geolocation获取不到地理位置信息解决办法

    今天开发应用,获取地理位置,最先采用H5的Geolocation的方法来获取地理位置,经过测试发现安卓的机子可以,但是IOS的就是不行,一查资料才知道:10.0苹果版本需要协议为https的才可以获取 ...

  5. EasyUI中combobox的使用方法和一个代码实例

    一.easyUI中select下拉框动态添加option选项 问题:想在combobox的下拉项里动态添加一些内容,但是添加不成功.因为jquery easyui的下拉列表combobox是用DIV模 ...

  6. OpenGL视图--gluPerspective glOrtho glFrustum gluLookAt

    void gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar ) near 和 far 决定了投 ...

  7. 解决Sqlserver 2008 R2在创建登录名出错"此版本的 Microsoft Windows 不支持 MUST_CHANGE 选项。 (Microsoft SQL Server,错误: 15195)"

    错误信息:   执行 Transact-SQL 语句或批处理时发生了异常. (Microsoft.SqlServer.ConnectionInfo)   此版本的 Microsoft Windows ...

  8. VS2008中生成DLL项目

    创建项目 新建项目-> 选择Win32项目 输入项目名称,点击确定.在程序向导中选择下一步 选择DLL. 由于我想创建的是相对独立的DLL,所以不选择ATL和MFC. 点击完成.   Main文 ...

  9. JSON字符串转换为Map

    本文是利用阿里巴巴封装的FastJSON来转换json字符串的.例子如下: package com.zkn.newlearn.json; import com.alibaba.fastjson.JSO ...

  10. js数组对象深度复制

    var deepCopy = function(o) { if (o instanceof Array) { var n = []; for (var i = 0; i < o.length; ...