RHCE7--systemctl command

Source: Internet
Author: User

To query the status of all cells:

[[Email protected] ~]# systemctl UNIT LOAD ACTIVE SUB descriptionproc-sys-fs-Binfmt_misc.automount loaded active waiting arbitrary executable file Formats file System Automo Unsys-devices-pci00...get1:0:0-1:0:0:0-block-sr0.device Loaded Active plugged vbox_cd-Romsys-devices-pci0000:xx-0000:xx:03.0-net-enp0s3.device loaded active plugged Pro/ +MT Desktop Adaptersys-devices-pci00 ...0-0000:xx:05.0-sound-card0.device loaded active plugged 82801AA AC'The Audio Controllersys-devices-pci0000:xx-0000:xx:08.0-net-enp0s8.device loaded active plugged Pro/ +MT Desktop Adaptersys-devices-pci00 ...0:0-2:0:0:0-block-sda-Sda1.device loaded active plugged Vbox_harddisksys-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_harddisksys-devices-platform-serial8250-tty-ttys0.device Loaded Active PLUGGED/SYS/DEVICES/PLATFORM/SERIAL8250/TTY/TTYS0
...

Querying the status of service units only:

[Email protected] ~]# systemctl--type=serviceunit                                                   LOAD   ACTIVE SUB     descriptionabrt-  Ccpp.service                                      Loaded Active exited  Install ABRT coredump hookabrt-oops.service                                      loaded Active Running ABRT kernel log watcherabrt-xorg.service                                      loaded active running ABRT xorg log watcherabrtd.service< c11/>loaded Active running ABRT automated Bug Reporting toolaccounts-daemon.service                                loaded Active Running Accounts Service ...

To view any cells that are in a failed or maintained state:

[Email protected] ~]# systemctl status Rngd.service-Lrngd.service-Hardware RNG Entropy Gatherer Daemon loaded:loaded (/usr/lib/systemd/system/rngd.service; enabled) Active:failed (Result:exit-code) since Fri -- -- -  One: ,: -CST; 32min ago Process:649Execstart=/sbin/rngd-f (code=exited, status=1/FAILURE) Main PID:649(Code=exited, status=1/FAILURE) CGroup:/system.slice/Rngd.servicejul -  One: ,: -Rhce7.example.com systemd[1]: Started Hardware RNG Entropy Gatherer daemon.jul -  One: ,: -Rhce7.example.com rngd[649]: Unable to open file:/dev/Tpm0jul -  One: ,: -Rhce7.example.com rngd[649]: Can'T Open any entropy sourceJul -  One: ,: -Rhce7.example.com rngd[649]: Maybe RNG device modules is not Loadedjul -  One: ,: -Rhce7.example.com systemd[1]: Rngd.service:main process exited, code=exited, status=1/Failurejul -  One: ,: -Rhce7.example.com systemd[1]: Unit Rngd.service entered failed state. [[Email protected]~]#

To see if a specific cell is active:

is-active sshdactive

To see if a specific cell has been turned on since startup:

is-enabled sshdenabled

Lists the active states of all loaded units

[Email protected] ~]# systemctl list-units--type=serviceunit                         LOAD   ACTIVE SUB     descriptionabrt- Ccpp.service            Loaded active exited  Install ABRT coredump hookabrt-oops.service            loaded Active Running ABRT kernel log watcherabrt-xorg.service            loaded active running ABRT xorg log watcherabrtd.service< c11/>loaded Active running ABRT automated Bug Reporting accounts-daemon.service      loaded active running Accounts Servicealsa-state.service           loaded active running Manage Sound Card State (Restatd.service                  loaded active running JOB spooling tools

View enabled and disabled settings for all cells

[Email protected] ~]# systemctl list-unit-files--type=serviceunit FILE State   ABRT-  Ccpp.service                           enabled ABRT-oops.service                           enabled ABRT-pstoreoops.service                     DISABLEDABRT-vmcore.service                         enabled ABRT-xorg.service                           enabled Abrtd.service                               Enabled accounts-daemon.service                     enabled Alsa-restore.service                        static

To view the status of a failed service

 [[email protected] ~]# systemctl list-unit-files--type=serviceunit FILE State ABRT -ccpp.service enabled ABRT -oops.service enabled ABRT -pstoreoops.service disabledabrt -vmcore.service                               Enabled ABRT -xorg.service enabled Abrtd.service  Enabled accounts -daemon.service enabled Alsa -restore.service static  

Shielding Services
Sometimes conflicting services may be installed, such as network and Networkmanager,iptables and FIREWALLD
You can mask the service. Masking creates a link in the configuration directory so that nothing happens when the service is started

[email protected] ~'/dev/null'/etc/systemd/system/ Network.service'~'/etc/systemd/system/network.service '

RHCE7--systemctl command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.