CentOS Training P1

Published: 20 February 2019
on channel: Vallabh Darole
57
0

CentOS-7 Training:

Chapter : 1
Controlling Services and Daemons
Overview:
=========
Goal : To review how to manage services.
Objectives : Manage how systemd starts up system daemons and network services using systemctl.
Sections : Controlling Services with systemctl(and Practice).

Introduction to systemd

System startup and server processes are managed by the systemd System and Service Manager. This program provides a method for activating system resources, server daemons, and other processes, both at boot time and on a running system.

Daemons are processes that wait or run in the background performing various tasks . To listen for connections, a daemon uses a socket. Sockets may be created by daemons or may be separated from the daemon and be created by another process, such as systemd, which then passes the socket to the daemon when a connection is established by a client.

A service often refers to one or more daemons, but starting or stopping a service may instead make a one-time change to the state of the system (for example, to configure network interfaces), which does not involve leaving a daemon process running afterward.

A bit of history

For many years, process ID 1 of Linux and UNIX systems has been the init process. This process was responsible for activating other services on the system . Frequently used daemons were started on systems at boot time with SystemV and Linux Standard Base (LSB) init scripts. Less frequently used daemons were started on demand by another service, such as initd or xinetd . These systems have several limitations , which are addressed with systemd.

In Red Hat Enterprise Linux 7, process ID 1 is systemd, the new init system. A few of the new features provided by systemd include :

• Parallelization capabilities, which increase the boot speed of a system .

•On -demand starting of daemons without requiring a separate service.

• Automatic service dependency management prevents long time outs, such as not starting a network service when the network is not available.

• A method of tracking related processes together using Linux control groups.

systemctl and systemd units
The systemctl command is used to manage different types of systemd objects, called units.

Some common unit types are listed as follows:

Service units have a .service extension and represent system services. This is type of units is used to start frequently accessed daemons, such as a web server.

Socket units have a .socket extension and represent interprocess communication (IPC) sockets. Control of the socket will be passed to a daemon or newly started service when a client connection is made. Socket unit are used to delay the start of a service at boot time and to start less frequently used services on demand . These are similar in principle to services which use the xinetd super server to start on demand.

Path units have a .path extension and are used to delay the activation of a service until a specific file system change occurs. This is commonly used for services which use spool directories, such a s a printing system .

Service states

The status of a service can be view with systemctl status name.type. If the unit type is not provided systemctl will show the status of a services unit, if one exists Several keywords indicating the state of the service can be found in the status output.

loaded :Unit configuration file has been processed.
active(running) :Running with one or more continuing processes.
active(exited) :Successfully completed a one-time configuration.
active(waiting) :Running but waiting for an event
inactive :Not running.
enabled :Will be started at boot time
disabled :Will not be started at boot time.
static :Cannot be enabled, but may be started by an enabled unit automatically

Summary of systemctl commands.

Services can be started and stopped on a running system and enabled or disabled for automatic start at boot time.
Co d : Ta s k :
systemctl status UNIT View detailed information about unit state.
systemctl stop UNIT Stop a service on a running system.
systemctl start UNIT Start a service on running system
systemctl restart UNIT Restart a service on running system.
systemctl reload UNIT reload configuration of a running service.
systemctl mask UNIT Completely disable a service from being started , both manually and at boot.
systemctl unmask UNIT Make a masked service available.
systemctl enable UNIT Configure a service to start at booting time.
systemctl disable UNIT Disable service from starting at boot time.
systemctl list-dependencies UNIT List units which are required and wanted by specified unit.


Watch video CentOS Training P1 online without registration, duration hours minute second in high quality. This video was added by user Vallabh Darole 20 February 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 57 once and liked it 0 people.