RHCE7 -- systemctl命令
查询所有单元的状态:
[root@rhce7 ~]# systemctl
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automoun
sys-devices-pci00...get1::-:::-block-sr0.device loaded active plugged VBOX_CD-ROM
sys-devices-pci0000:-::03.0-net-enp0s3.device loaded active plugged PRO/ MT Desktop Adapter
sys-devices-pci00...-::05.0-sound-card0.device loaded active plugged 82801AA AC'97 Audio Controller
sys-devices-pci0000:-::08.0-net-enp0s8.device loaded active plugged PRO/ MT Desktop Adapter
sys-devices-pci00...:-:::-block-sda-sda1.device loaded active plugged VBOX_HARDDISK
sys-devices-pci00...:-:::-block-sda-sda2.device loaded active plugged LVM PV ewUQqv-N1i5-9xcA-GRad-2BLV-qOTh-vNPOd2 on /dev/
sys-devices-pci00...get2::-:::-block-sda.device loaded active plugged VBOX_HARDDISK
sys-devices-platform-serial8250-tty-ttyS0.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0
...
仅查询服务单元的状态:
[root@rhce7 ~]# systemctl --type=service
UNIT LOAD ACTIVE SUB DESCRIPTION
abrt-ccpp.service loaded active exited Install ABRT coredump hook
abrt-oops.service loaded active running ABRT kernel log watcher
abrt-xorg.service loaded active running ABRT Xorg log watcher
abrtd.service loaded active running ABRT Automated Bug Reporting Tool
accounts-daemon.service loaded active running Accounts Service
...
查看处于失败或维护状态的任何单元:
[root@rhce7 ~]# systemctl status rngd.service -l
rngd.service - Hardware RNG Entropy Gatherer Daemon
Loaded: loaded (/usr/lib/systemd/system/rngd.service; enabled)
Active: failed (Result: exit-code) since Fri -- :: CST; 32min ago
Process: ExecStart=/sbin/rngd -f (code=exited, status=/FAILURE)
Main PID: (code=exited, status=/FAILURE)
CGroup: /system.slice/rngd.service Jul :: rhce7.example.com systemd[]: Started Hardware RNG Entropy Gatherer Daemon.
Jul :: rhce7.example.com rngd[]: Unable to open file: /dev/tpm0
Jul :: rhce7.example.com rngd[]: can't open any entropy source
Jul :: rhce7.example.com rngd[]: Maybe RNG device modules are not loaded
Jul :: rhce7.example.com systemd[]: rngd.service: main process exited, code=exited, status=/FAILURE
Jul :: rhce7.example.com systemd[]: Unit rngd.service entered failed state.
[root@rhce7 ~]#
查看特定单元是否活动:
[root@rhce7 ~]# systemctl is-active sshd
active
查看特定单元是否已经开启自启动:
[root@rhce7 ~]# systemctl is-enabled sshd
enabled
列出所有已经加载单元的活动状态
[root@rhce7 ~]# systemctl list-units --type=service
UNIT LOAD ACTIVE SUB DESCRIPTION
abrt-ccpp.service loaded active exited Install ABRT coredump hook
abrt-oops.service loaded active running ABRT kernel log watcher
abrt-xorg.service loaded active running ABRT Xorg log watcher
abrtd.service loaded active running ABRT Automated Bug Reporting
accounts-daemon.service loaded active running Accounts Service
alsa-state.service loaded active running Manage Sound Card State (rest
atd.service loaded active running Job spooling tools
查看所有单元的已启用和已禁用设置
[root@rhce7 ~]# systemctl list-unit-files --type=service
UNIT FILE STATE
abrt-ccpp.service enabled
abrt-oops.service enabled
abrt-pstoreoops.service disabled
abrt-vmcore.service enabled
abrt-xorg.service enabled
abrtd.service enabled
accounts-daemon.service enabled
alsa-restore.service static
查看失败的服务的状态
[root@rhce7 ~]# systemctl list-unit-files --type=service
UNIT FILE STATE
abrt-ccpp.service enabled
abrt-oops.service enabled
abrt-pstoreoops.service disabled
abrt-vmcore.service enabled
abrt-xorg.service enabled
abrtd.service enabled
accounts-daemon.service enabled
alsa-restore.service static
屏蔽服务
有时候可能安装了互相冲突的服务,比如network和NetworkManager,iptables和firewalld
可以将服务屏蔽。屏蔽将在配置目录中创建链接,使的启动该服务时不发生任何事
[root@rhce7 ~]# systemctl mask network
ln -s '/dev/null' '/etc/systemd/system/network.service'
[root@rhce7 ~]# systemctl unmask network
rm '/etc/systemd/system/network.service'
禁用服务
[root@rhce7 ~]# systemctl disable network
network.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig network off
[root@rhce7 ~]#
禁用服务和屏蔽服务的区别:
·禁用服务:服务不会再系统系统的时候自动启动,也不会被其它单元文件启动,但可以手动启动
·屏蔽服务:无法手动启动,也无法自启动
RHCE7 -- systemctl命令的更多相关文章
- Centos7中systemctl命令详解
Linux Systemctl是一个系统管理守护进程.工具和库的集合,用于取代System V.service和chkconfig命令,初始进程主要负责控制systemd系统和服务管理器.通过Syst ...
- 【搬运】systemctl 命令完全指南
Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器. Systemd是一个系统管理守护进程.工具和库的集合,用于取代System V初始进程.Systemd的功能是 ...
- systemctl命令用法详解
systemctl命令用法详解系统环境:Fedora 16binpath:/bin/systemctlpackage:systemd-units systemctl enable httpd.serv ...
- centos7 systemctl命令
systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起. 实例: 启动nfs服务:systemctl start nfs-server.s ...
- systemctl命令
systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起. 任务 旧指令 新指令 使某服务自动启动 chkconfig --level 3 ...
- centos7中systemctl命令使用方法和心得体会
使用linux的同学对service和chkconfig两个命令都不陌生,其重要性不言而喻,那么怎么会突然冒出个systemctl命令呢?其实,为了简化操作,systemctl命令将service和c ...
- systemctl 命令完全指南
http://www.linuxidc.com/Linux/2015-07/120833.htm Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器. System ...
- (转)systemctl 命令完全指南
场景:在使用chkconfig查看vsftpd是否看机启动时候看不到启动项,用systemctl 才看到自己想要的结果 1 总结 from:https://linux.cn/article-5926- ...
- Linux systemctl 命令完全指南
Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器. Systemd是一个系统管理守护进程.工具和库的集合,用于取代System V初始进程.Systemd的功能是 ...
随机推荐
- Python并发编程-redis-3.0.5 源码安装
1.简介 Remote Dictionary Server(Redis)是一个基于 key-value 键值对的持久化数据库存储系统.redis 和 Memcached 缓存服务很像,但它支持存储的 ...
- [leetcode]Flatten Binary Tree to Linked List @ Python
原题地址:http://oj.leetcode.com/problems/flatten-binary-tree-to-linked-list/ 题意: Given a binary tree, fl ...
- Python的知识点 plt.plot()函数细节
1.plt.plot(x,y,format_string,**kwargs) 转自点击打开链接x轴数据,y轴数据,format_string控制曲线的格式字串 format_string 由颜色字符, ...
- iOS开发-Interface Builder的前世今生
Interface Builder,是用于苹果公司Mac OS X操作系统的软件开发程序,Xcode套件的一部分,于1988年创立.它的创造者Jean-Marie Hullot自称是“一个热爱旅行.充 ...
- Hibernate 不同数据库的连接及SQL方言
<!--MySql 驱动程序 eg. mysql-connector-java-5.0.4-bin.jar--> <property name="dialect" ...
- js获取checkbox中所有选中值及input后面所跟的文本
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- (转)<Unity3D>Unity3D在android下调试
转自:http://blog.csdn.net/zuoyamin/article/details/11827309 一.工具准备 1.JDK——由于android是基于Java平台开发的,jdk是必须 ...
- 劣质代码评析——《写给大家看的C语言书(第2版)》附录B之21点程序(六)
. #include <stdio.h> . #include <time.h> . #include <ctype.h> . #include <stdli ...
- C#.NET常见问题(FAQ)-如何捕捉窗体关闭的事件,弹窗确认是否退出
首先定位到窗体的FormClosing事件中,写关闭之前要执行的方法名称 一般只需要添加下面的代码即可实现窗体关闭的时候提示是否确认退出 //捕捉窗体Close事件,关闭窗口时提示 if (Mes ...
- Discuz常见大问题-如何使用图片轮播器
最简单的办法是用插件,在应用-插件中电机对应插件的设置(比如使用柒瑞幻灯图片展插件) 在展示图片参数设置中,按照要求放你要的设置(标题,注释,高清大图,缩略小兔,URL地址)注意一个都不能少,标题和注 ...