rh124-08 System services and daemon management

Source: Internet
Author: User
Tags openssh server

Eighth chapter system service and daemon process management



8.1 Learn about self-booting system services


In RHEL7, system startup and service processes are systemd managed. This systemd is responsible for activating system resources, service daemons, and other processes during system startup or system operation.

SYSTEMD replaces the previous system V and INIT program initiation Systems in the Rhel family, and its ultimate goal is to provide a better framework to represent the dependencies between system services and to achieve the parallel start-up efficiency of the services provided by the system initialization. Reduce the use of shell scripts and the effect of system overhead

SYSTEMD uses the service unit for the start of the basic unit management system.



SYSTEMD Service Management: The service's startup script is replaced by the service unit, which ends with the. service file extension and provides the same functionality as the service startup script. The service unit reads the configuration file for Systemd.

Systemctl is-enabled sth.service Query service is booting up

Systemctl is-active sth.service Query service is running

Systemctl status Sth.service query service run status

Systemctl--failed--tyoe=service Query starts a failed service


Systemctl list-units--type=service Lists all the unit that has been loaded and activated (running),--type specifies the category of the unit,--all lists all the unit, including inactive (non-active)


Systemctl list-unit-files--type=service Lists all unit boot-up settings (equivalent to previous chkconfig--list)

Systemctl list-dependencies [Sth.unit]



Service Status Description:

The configuration file for the loaded service unit has been processed

One or more processes in the active (running) service are running

Active (exited) some one-time running services have been successfully executed and exited (one-time service: Complete the task after the service runs, the related process will automatically exit)

The active (Waiting ) service is already running but is waiting for an event

The inactive service is not running

The enabled service is set to start running

Disabled Service set to boot not running

The static service cannot be set up for boot, but can be started by another service



8.2 Starting and controlling system services


Systemctl Enable Sth.service to run the service automatically

Systemctl Disable Sth.service boot cancel running the service (but the user can manually start the service later)

Systemctl start Sth.service launch service now

Systemctl Stop Sth.service immediately stops service

Systemctl Restart Sth.service Restart Service

Systemctl Reload Sth.service Heavy Duty Service

Systemctl Mask Sth.serivce service is disabled (boot start and manual post-boot services will also be banned, the currently running service is not immediately affected)

Systemctl umask sth.service Disable service operation







Notes:


[[email protected] desktop]$ Systemctl is-enabled sshd to see if boot started

Enabled

[[email protected] desktop]$ Systemctl is-active sshd is now active

Active

[Email protected] desktop]$ systemctl status sshd

Sshd.service-openssh Server Daemon

Loaded:loaded (/usr/lib/systemd/system/sshd.service; enabled)

Active:active (running) since Thu 2017-05-25 16:52:18 CST; 1 weeks 1 days ago

process:1528 Execstartpre=/usr/sbin/sshd-keygen (code=exited, status=0/success)

Main pid:1547 (sshd)

CGroup:/system.slice/sshd.service

└─1547/usr/sbin/sshd-d


[[email protected] ~]# systemctl disable sshd boot does not change the current state

RM '/etc/systemd/system/multi-user.target.wants/sshd.service '

[[email protected] ~]# systemctl enable sshd boot

Ln-s '/usr/lib/systemd/system/sshd.service '/etc/systemd/system/multi-user.target.wants/sshd.service '







[[email protected] ~]# Systemctl Reload sshd Reload, process will not break

Job for Sshd.service failed. See ' systemctl status Sshd.service ' and ' journalctl-xn ' for details.

[[email protected] ~]# systemctl restart sshd reboot, the process will be broken,


This article is from the "hcie_38xx" blog, make sure to keep this source http://hciewd.blog.51cto.com/3272922/1931936

rh124-08 System services and daemon management

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.