RHEL - Ch. 9 - CONTROLLING SERVICES AND DAEMONS

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Reloading a service

Some services have the ability to reload their configuration files without requiring a restart. Thisprocess is called a service reload. Reloading a service does not change the process ID associated with various service processes. To reload a running service, use the reload argument with the systemctl command. The example below shows how to reload the sshd.service service after configuration changes: ------------------------------------------------------------ [root@host ~]# systemctl reload sshd.service

To disable the service from starting automatically, use the following command, which removes the symbolic link created while enabling a service. Note that disabling a service does not stop the service. ____________________________________

systemctl disable sshd.service

To start a service at boot, use the ___________ ____________ command.

systemctl enable service

To verify whether the service is enabled or disabled, use the _____________________ command.

systemctl is-enabled

LISTING UNIT DEPENDENCIES W/______________

systemctl list-dependencies UNIT

Services

A service in the systemd sense 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, which does not involve leaving a daemon process running afterward (called oneshot).

Daemons

Daemons are processes that either wait or run in the background, performing various tasks. Generally, daemons start automatically at boot time and continue to run until shutdown or until they are manually stopped. It is a convention for names of many daemon programs to end in the letter d. -------------------------- Daemons run in the background independently of the user. Typically, a daemon waits for specific system activity and then acts accordingly.

Restarting a service

During a restart of a running service, the service is stopped and then started. On the restart of service, the process ID changes and a new process ID gets associated during the startup. ------------------------------------------------------ To restart a running service, use the restart argument with the systemctl command. The example below shows how to restart the sshd.service service: ------------------------------------------------------------- [root@host ~]# systemctl restart sshd.service

[ True / False ] ----------------------------------------------------------------- Enabling a service starts the service in the current session.

FALSE ------------------------------------------------------------- To start the service and enable it to start automatically during boot, execute both the systemctl start and systemctl enable commands.

MASKING AND UNMASKING SERVICES

Masking a service prevents an administrator from accidentally starting a service that conflicts with others. Masking creates a link in the configuration directories to the /dev/null file which prevents the service from starting. ---------------------------------------------------------- systemctl mask sendmail.service systemctl unmask sendmail.service Created symlink /etc/systemd/system/sendmail.service → /dev/null. --------------------------------------------------------- Attempting to start a masked service fails w/an error mssg. --------------------------------------------------------

systemd

The systemd daemon manages startup for Linux, including service startup and service management in general. It activates system resources, server daemons, and other processes both at boot time and on a running system. ----------------------- A Daemon that manages all other system daemons. It's the first daemon to start during the boot process and is the last daemon to stop during shutdown. Allows processes, daemons, and services to start parallel to each other and creating a faster boot process

STARTING AND STOPPING SERVICES

To start a service, first verify that it is not running with systemctl status. Then, use the systemctl start command as the root user (using sudo if necessary). The example below shows how to start the sshd.service service: ------------------------------------------------------------ [root@host ~]# systemctl start sshd.service The systemd service looks for .service files for service management in commands in the absence of the service type with the service name. Thus the above command can be executed as: [root@host ~]# systemctl start sshd ----------------------------------------------------------- To stop a currently running service, use the stop argument with the systemctl command. The example below shows how to stop the sshd.service service: [root@host ~]# systemctl stop sshd.service

How to list service units

You use the systemctl command to explore the current state of the system. For example, the following command lists all currently loaded service units, paginating the output using less: --- systemctl list-units --type=service --- By default, the systemctl list-units --type=service command lists only the service units with active activation states. The --all option lists all service units regardless of the activation states. Use the --state= option to filter by the values in the LOAD, ACTIVE, or SUB fields. --- The systemctl command without any arguments lists units that are both loaded and active.

VERIFYING THE STATUS OF A SERVICE

[root@host ~]# systemctl is-active sshd.service active ----------------------------------------------------- [root@host ~]# systemctl is-enabled sshd.service enabled ---------------------------------------------------- To verify whether the unit failed during startup, run the following command: [root@host ~]# systemctl is-failed sshd.service active ---------------------------------------------------- To list all the failed units, run the systemctl --failed --type=service command.

Check if a service has the functionality to reload the configuration file changes, use ______________________

reload-or-restart argument with the systemctl command. --------------------------------------------------------- # systemctl reload-or-restart sshd.service

systemd service units

systemd uses units to manage different types of objects. Some common unit types are listed below: • Service units have a .service extension and represent system services. This type of unit is used to start frequently accessed daemons, such as a web server. • Socket units have a .socket extension and represent inter-process communication (IPC) sockets that systemd should monitor. If a client connects to the socket, systemd will start a daemon and pass the connection to it. Socket units are used to delay the start of a service at boot time and to start less frequently used services 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 as a printing system. The systemctl command is used to manage units. For example, display available unit types with the systemctl -t help command.


Kaugnay na mga set ng pag-aaral

Basic Python Interview Questions

View Set

Earth Day - April 22 地球日 - 4月22日

View Set

UCF - IDS 3933 - Devon Bazata - WWW - Final

View Set

Tema 1: La crisis del Antiguo Régimen, Tema 2: Revoluciones liberales y nacionalismo, Tema 3: La Revolución Industrial y los cambios sociales, Tema 5. Imperialismo, guerra y revolución

View Set

Organizational Leadership BA 205 - Chapter 11

View Set