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. mysql必知必会(四、检索数据,五、排序检索数据,六、过滤数据,七、数据过滤)

    四.select语句 1.检索单个列 select prod_name from products; 2.检索多个列 select prod_name, prod_price from product ...

  2. 【华为OJ平台练习题】求最大公共子串的个数和元素

    1.原题是求出最大公共子串的个数就可以 原理:利用二维矩阵排列的方式.将俩字符串进行比較 #include <iostream> #include <vector> using ...

  3. NodeBB,一个基于nodejs的响应式论坛

    喜欢方便的同学请绕道去discuz,好吧我是nodejs的重视患者,首先你要有自己的vps或则云空间,比如9cloud,我今天用的是阿里云的VPS. 进入阿里云Ubuntu主机 .... 输入密码进入 ...

  4. 使用Editplus配置PHP调试环境

    工欲善其事必先利其器.近期看了非常多PHP的IDE介绍.最后选择了Editplus.以下说说一些PHP的调试环境配置问题. 1. 加入PHP模板 第一步 新建->其他->php 第二步 输 ...

  5. ZH奶酪:PHP图片压缩(TinyPNG在线API)和(使用Imagick扩展)

    1.调用TinyPng网站提供的API 1.1.须知 (1)tinypng的官网:https://tinypng.com/ 不知道国内访问会不会很慢,在Singapore打开这个网站很流畅: (2)A ...

  6. PHP高级教程-安全邮件

    PHP Secure E-mails 在上一节中的 PHP e-mail 脚本中,存在着一个漏洞. PHP E-mail 注入 首先,请看上一章中的 PHP 代码: <html> < ...

  7. Hibernate(三)结构-配置文件-实体映射及配置文件

    一.体系结构 SessionFactory:属于单一数据库的编译过的映射文件的一个线程安全的,不可变的缓存快照.Session的工厂.有可能持有一个可选的数据缓存可以进程级别或者群级别保存可以在事务中 ...

  8. 算法笔记_117:算法集训之结果填空题集一(Java)

     目录 1 空瓶换汽水 2 三人年龄 3 考察团组成 4 微生物增殖 5 除去次方数 6 正六面体染色 7 古堡算式 8 海盗比酒量 9 奇怪的比赛 10 土地测量   1 空瓶换汽水 浪费可耻,节约 ...

  9. linux远程

    apt-get install rdesktop $rdesktop -u administrator -p ****** -a 16 192.168.1.1 //都直接登陆了,

  10. git检查与放弃本地的代码修改情况

    git diff  可以查看当前没有add 的内容修改(不在缓冲区的文件变化) git diff --cached查看已经add但没有commit 的改动(在缓冲区的文件变化) git diff HE ...