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的功能是 ...
随机推荐
- 告诉我, 究竟我的SQL Server慢在哪里?
你可以使用下面的语句来使用sys.dm_os_wait_stats这个DMV得到线程的等待信息(线程在等什么, 等了多久)的统计数值. WITH [Waits] AS (SELECT [wait_ty ...
- [Node.js]32. Level 7: Working with Lists -- Redis
As we saw in the video, redis can do more than just simple key-value pairs. We are going to be using ...
- 开放Fedora10自带的MySQL5.0.67的对外数据库服务
MySQL5.0.67是Fedora10安装时的可选项目. 测试的笔记本IP为192.168.0.100,作为安装Fedora10和MySQL5.0.67的服务器BlackMachine的IP地址为1 ...
- WPF{ComboBox绑定类对象, 下拉列显示的值,与取到的值}
DisplayMemberPath 是用来显示下拉列表的值 SelectedValuePath是用来取得选中项的值. ComboBox绑定类对象, 下拉列显示的值,与取到的值 string. Join ...
- linux可视化桌面安装
[root@VM_193_201_centos ~]# yum grouplist Loaded plugins: fastestmirror, langpacks There is no insta ...
- 高可用性(HA) 4 - network bonding
我们都知道,hadoop namenode是一个臭名昭著的单点故障点(SPOF). 当你找到一篇High Availability的文章, 以为使用heartbeat/pacemaker, coro ...
- serialport控件的详细用法
http://www.cnblogs.com/jerry-bian/archive/2012/01/10/2317861.html 最近在做通讯协议,关于SerialPort类 DataReceive ...
- MySQL 数据库几种类型
关系数据库(MySQL.Oracle.SQL Server.DB2.Postgres)键-值存储数据库(Riak和Redis)面向列的数据库(HBase) 面向文档的数据库(MongoDB 和Couc ...
- spring boot 环境搭建
1.开发工具 https://spring.io/tools/sts/all 2.demo https://start.spring.io 3.下载maven https://maven.apache ...
- 如何解决Cydia提示错误
删除/etc/apt/sources.list.d该目录下的cydia.list进入var/lib/apt/lists删掉此文件夹下的所有文件,以及partial下的文件,但须保留这个空文件夹.进入/ ...