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的功能是 ...
随机推荐
- iOS开发-照片选择
本来想做个注册登录的表单的,想想还是先做个简单的头像选择,一般情况下不管是内部管理系统还是面向公众的互联网公司,注册登录是免不了的,用户头像上传是免不了的,尤其是企业用户,上传了自己的图片才感觉自己买 ...
- 用C#代码编写的SN快速输入工具
一般软件都要输入序列号(SN),而大家平时用的最多的恐怕是盗版软件,通常盗版软件的序列号(SN)都保存成:XXXXX-XXXXX-XXXX-XXXX的形式. 而软件输入序列号的地方通常都是几个文本框( ...
- Inside GDALAllRegister之二: 自动加载驱动
代码 GetGDALDriverManager()->AutoLoadDrivers(); 包含了两部分: 首先获得GDALDriverManager的singleton对象的指针,这点之 ...
- 分布式文件存储FastDFS(七)FastDFS配置文件具体解释
配置FastDFS时.改动配置文件是非常重要的一个步骤,理解配置文件里每一项的意义更加重要,所以我參考了大神的帖子,整理了配置文件的解释.原帖例如以下:http://bbs.chinaunix.net ...
- 单点登录(SSO)(原创)
单点登录(Single Sign On),简称为 SSO,是目前比较流行的企业业务整合的解决方案之一.SSO的定义是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统. 下面的sso ...
- c的链接详解
多目标文件的链接 stack.c #include <stdio.h> #define STACKSIZE 1000 typedef struct stack { int data[STA ...
- MySQL中int(5) 中的5代表什么意思?
对于INT型,MySQL支持指定显示宽度例如:int(5):表示如果数值宽度小于5位,则填满宽度,保证总宽度为5位.默认为int(11),配合zerofill可以看到效果. DROP TABLE IF ...
- 1z0-052 q209_8
8: Note the following structures in your database server: 1. Extents 2. OS Blocks 3. Tablespace 4. S ...
- win7,8,10取得|取消管理员权限
取得: Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\*\shell\runas]@=”管理员取得所有权”“NoWorkingDirec ...
- OpenERP 在context中写自己的部门ID
使用OpenERP自定义模块开发的时候,你会发现,有一个uid(当前登录用户id)特别好用,不管是在xml的domain 条件表达式中,还是在类中,都能很方便的使用uid.有一段时间就一直在琢磨,这个 ...