# Control Services and Daemons ## Dennis Kibbe ### Mesa Community College Note: This slide presentation was created using [Reveal.js](https://revealjs.com/). You can access a transcript of this presentation by pressing S for speaker notes. You can access navigation help by pressing the question mark key. Audio for this presentation is artificially generated. --- # Module Outline 1. Introduction 1. Identify Automatically Started System Processes 1. Guided Exercise 1. Control System Services 1. Guided Exercise 1. Key Takeaways 1. Resources 1. Graded Lab Note: --- # Learning Objectives *After completing the work in this module you will be able to:* 1. List system daemons and network services started by the systemd units. 1. Control system daemons and network services, using `systemctl`. Note: --- # Control Services and Daemons (replace me) ## The systemd Daemon ![screenshot](../images/rh124-9-1.png) Note: After the kernel loads itself into memory systemd is the first process (PID 1) run and is responible for bring up the rest of the system. It spawns all the following processes using fork and exec. --- # Core Features of systemd - The boot process is much simpler compared to the older init process. - Concurrent and parallel starting of processes allows faster boot speed. - Processes are tracked using control groups, not by PIDs. - Improved handling of boot and service dependencies. - System snapshots and restore points - Crashed services can be restarted. - Low memory footprint - journald module for event logging Note: --- # Describing Service Units - **.service units**: Used to start frequently accessed daemons. - **.socket units**: Represent inter-process communication (IPC) sockets that systemd should monitor. - **.path units**: Used to delay the activation of a service until a specific file system change occurs. Note: A systemd unit defines objects that the system knows how to manage. A unit has a name and a unit type. --- # Listing Service Units ![screenshot](../images/rh124-9-2.png) Note: The `systemctl` command is used to manage systemd. Here `systemctl` is used to list service units. --- # Viewing Service States ![screenshot](../images/rh124-9-3.png) Note: This screenshot shows that the chrony daemon is running and is enabled so that it will run if the system is rebooted. --- # Verifying the Status of a Service ![screenshot](../images/rh124-9-4.png) Note: Here is another way to show that chronyd is running. --- # Guided Exercise ## Identify Automatically Started System Processes ![Lab technicians holding clipboard.](../images/lab_techs.png) Note: In this exercise, you list installed service units and identify which services are currently enabled and active on a server. --- # Control System Services Note: The `systemctl` command is used to start, stop, restart, and reload services. --- # Check the Status of a Service ![screenshot](../images/) Note: # Starting a Service ![screenshot](../images/rh124-9-7.png) Note: Starting a service does not keep it running if the system reboots. The service must also be enabled. --- # Stopping a Service ![screenshot](../images/rh124-9-5.png) Note: A stopped service will restart when the system reboots if it has been enabled. --- # Restarting a Service ![screenshot](../images/rh124-9-9.png) Note: Restarting a service terminates all connections and restarts the service using a new Process ID. --- # Reloading a Service ![screenshot](../images/rh124-9-10.png) Note: Reloading is used when you just want to re-read the configuration file. Current connections continue using the same Process ID> --- # List Unit Dependencies ![screenshot](../images/rh124-9-11.png) Note: Here the dependencies for chrony are listed. --- # Masking a Service ![screenshot](../images/rh124-9-12.png) Note: Masking a service prevents a service from running. --- # Enabling Services at Boot ![screenshot](../images/rh124-9-13.png) Note: Enabling a service makes sure it starts up when the system boots. --- # Guided Exercise ## Control System Services ![Lab technicians holding clipboard.](../images/lab_techs.png) Note: In this exercise, you use `systemctl` to stop, start, restart, reload, enable, and disable a systemd-managed service. --- # Key Takeaways - systemd is the first process that runs on the system and spawns all following processes. - systemd enables faster reboot times and easier management of services. - The `systemctl` command is used to start, stop, reload, enable, and disable services. - Reloading a service keeps the same PID and doesn't terminate connections. - The `systemctl status` command is used to determine the status of system daemons and network services. - The `systemctl list-dependencies` command lists all service units upon which a specific service unit depends. - systemd can mask a service unit so that it does not run even to satisfy dependencies. Note: --- # Resources - [How To Use Systemctl to Manage Systemd Services and Units](https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units) - [What are the Steps of the Linux Boot Process?](https://youtu.be/sOIOY6Ks0xA) - [systemd on Linux 2: systemctl commands](https://youtu.be/fzOceeJB5vw) Note: --- # Graded Lab ## Control Services and Daemons ![Clipart of lab technicials](../images/lab_techs.png) Note: In this lab, you will configure several services to be enabled or disabled, running or stopped, based on a specification that is provided to you. --- ![Mesa Community College logo](../images/mcc_logo.png "Mesa Community College")