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. iOS开发-Xcode入门ObjC程序

    元旦三天假跟妹子冷战一天半,剩下的半天觉得无聊,可以写点东西,折腾了下xCode 6.1,虽然iPhone6比较丑,但是不影响IOS在高端机上面的地位,ObjC是扩充C的面向对象编程语言.主要使用于M ...

  2. Android中Intent的显示和隐式使用

    Android应用程序中组件之间的通信都少不了Intent的使用,Intent负责对应用中一次操作的动作.动作涉及数据.附加数据进行描述,Android则根据此Intent的描述,负责找到对应的组件, ...

  3. AS .ignore插件 忽略文件

    AS自带的.ignore文件 在AS中新建项目时,默认会创建一个.ignore文件,其中默认忽略的是 *.iml .gradle /local.properties /.idea/workspace. ...

  4. JavaScript中定义对象的四种方式

    最近在阅读< JavaScript 高级程序设计>,未免遗忘读过的内容,就打算以博客的形式做些读书笔记.今天介绍的是 JavaScript 中的四种定义对象的方法,除了这四种方法,还有工厂 ...

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

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

  6. CI框架入门中的简单MVC样例

    最简单的CI模型: 注意:模型须要用到数据库 配置文件在appcation/config.php 这里我们要用到数据库,须要将databases.php中的 相关參数填写一下,详细不再赘述. 直接进入 ...

  7. Cognos第三方用户认证(CustomJavaProvider)

    关于Cognos第三方用户认证(CustomJavaProvider)的demo网上的例子很多,当然最权威的你可以从Cognos安装的SDK中去探索,本文不详细的说明代码,主要说一下认证的处理过程,以 ...

  8. matlab中help所有函数功能的英文翻译

    doc funname 在帮助浏览器中打开帮助文档 help funname 在命令窗口打开帮助文档 helpbrowser 直接打开帮助浏览器 lookfor funname 搜索某个关键字相关函数 ...

  9. JS计算本周一和本周五的日期

    代码不长: var today=new Date();var weekday=today.getDay();    var monday=new Date(1000*60*60*24*(1-weekd ...

  10. Linux学习笔记--which命令(搜索命令的命令)

    which.哪一个的意思.作用是从PATH环境变量指定的路径中,搜索命令所在位置及命令别名. which命令特点: 1) "which" 命令仅仅能查找系统命令.不能搜索普通文件. ...