Introduction to Systemd on CentOS 7


A few terms we need to grasp:

  1. Daemons are processes that wait or run in the background performing various tasks.
  2. To listen for connections, a daemon uses a socket.
  3. service often refers to one or more daemons

If you are moving from CentOS 6 to CentOS 7, you may be wondering why the need to move to systemd. Here are the features

  1. Parallelization capabilities, which increase the boot speed of a system
  2. Automatic service dependency management which can prevent long time-out.
  3. A method of tracking related processes together by using Linux control groups
  4. On-demand starting of daemons without requiring a separate service

Listing unit files with systemctl

  1. Query the state of all units
    # systemctl
  2. Query the state of selected service
    # systemctl --type=service
  3. List full output of the selected service. Useful for detailed check and investigation
    # systemctl status sshd.service -l
  4. To check whether the particular is active and enabled to start at boot time
    # systemctl is-active sshd
    # systemctl is-enabled sshd
  5. List the active state of all loaded units. –all will include inactive units
    # systemctl list-units --type=service
    # systemctl list-units --type=service --all
  6. View the enabled and disabled settings for all units
    # systemctl list-unit-files --type=service
    
  7. View only failed services.
    # systemctl --failed --type=service
    

     


Controlling System Services

a. Status of a Service

# systemctl status sshd.service

b. Disable of a Service

# systemctl disable sshd.service

c. Enable and verify the status of a Service

# systemctl enable sshd.service
# systemctl is-enabled sshd.service

d. Reload configuration file of a running service

# systemctl is-enabled sshd.service
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s