标签:pst nts direct abr enabled 自启 sbin pstore loaded
查询所有单元的状态:
[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:0:0-1:0:0:0-block-sr0.device loaded active plugged VBOX_CD-ROM sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device loaded active plugged PRO/1000 MT Desktop Adapter sys-devices-pci00...0-0000:00:05.0-sound-card0.device loaded active plugged 82801AA AC‘97 Audio Controller sys-devices-pci0000:00-0000:00:08.0-net-enp0s8.device loaded active plugged PRO/1000 MT Desktop Adapter sys-devices-pci00...0:0-2:0:0:0-block-sda-sda1.device loaded active plugged VBOX_HARDDISK sys-devices-pci00...0:0-2:0:0:0-block-sda-sda2.device loaded active plugged LVM PV ewUQqv-N1i5-9xcA-GRad-2BLV-qOTh-vNPOd2 on /dev/ sys-devices-pci00...get2:0:0-2:0:0:0-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 2015-07-17 11:08:27 CST; 32min ago Process: 649 ExecStart=/sbin/rngd -f (code=exited, status=1/FAILURE) Main PID: 649 (code=exited, status=1/FAILURE) CGroup: /system.slice/rngd.service Jul 17 11:08:25 rhce7.example.com systemd[1]: Started Hardware RNG Entropy Gatherer Daemon. Jul 17 11:08:27 rhce7.example.com rngd[649]: Unable to open file: /dev/tpm0 Jul 17 11:08:27 rhce7.example.com rngd[649]: can‘t open any entropy source Jul 17 11:08:27 rhce7.example.com rngd[649]: Maybe RNG device modules are not loaded Jul 17 11:08:27 rhce7.example.com systemd[1]: rngd.service: main process exited, code=exited, status=1/FAILURE Jul 17 11:08:27 rhce7.example.com systemd[1]: 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 ~]#
禁用服务和屏蔽服务的区别:
·禁用服务:服务不会再系统系统的时候自动启动,也不会被其它单元文件启动,但可以手动启动
·屏蔽服务:无法手动启动,也无法自启动
标签:pst nts direct abr enabled 自启 sbin pstore loaded
原文地址:http://www.cnblogs.com/wangchaoyuana/p/7532042.html