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的功能是 ...
随机推荐
- 【Dagger2】简介 配置 使用 MVP案例
简介 dagger2:https://github.com/google/dagger Maven Central 2.11版本jar包下载 dagger:https://github.com/sq ...
- :Windows下RabbitMQ安装及入门
1.Windows下安装RabbitMQ需要以下几个步骤 (1):下载erlang,原因在于RabbitMQ服务端代码是使用并发式语言erlang编写的,下载地址:http://www.erlang. ...
- 眼前一亮!十八款新潮而又独特的网站Header设计
一个网站最重要的一个部分就是标题.这将是访问者的第一印象,设计出一个吸引眼球并且功能清晰导航还是比较容易的,但想出一个独特的header却总是困难的,这就是为什么我决定把那些对我有最影响的导航列出来了 ...
- leetcode 二分查找 Search in Rotated Sorted ArrayII
Search in Rotated Sorted Array II Total Accepted: 18500 Total Submissions: 59945My Submissions Follo ...
- Android -- ImageLoader本地缓存
传送门 <Android -- ImageLoader简析> http://www.cnblogs.com/yydcdut/p/4008097.html 本地缓存 在缓存文件时对文件名称 ...
- vs2013 密钥_
vs2013 密钥 最佳答案: BWG7X-J98B3-W34RT-33B3R-JVYW9
- 九度OJ 1006 ZOJ问题 (这题測试数据有问题)
题目1006:ZOJ问题 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:15725 解决:2647 题目描写叙述: 对给定的字符串(仅仅包括'z','o','j'三种字符),推断他能否AC ...
- poj1837--Balance(dp:天平问题)
Balance Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 10773 Accepted: 6685 Descript ...
- 【解决】缺少libstdc++.so.6库的原因及解决的方法
问题原因: 系统是64bit,该库是32bit的,在64bit系统上安装32bit库 解决的方法: 1. 查看哪个安装包包括该库:yum provides libstdc++.so.6 libs ...
- ArcGIS Pro体验03——主界面
主界面和Office类似,应该上手比较快.新建Map后,加载了美国地图,毕竟是ESRI公司嘛.除项目(PROJECT),另外还有六个菜单面板,分别是地图(MAP).插入(INSERT).分析(ANAL ...