Control Services and Daemons Flashcards
What is a daemon?
Daemons are processes that either wait or run in the background, to perform various tasks.
What does the systemd daemon do?
systemd manages the startup process for Linux, including service startup and service management in general.
What is a service within the systemd context?
A service in systemd often refers to one or more daemons.
What does PID stand for?
Process Identifier
In Red Hat Enterprise Linux, what is the first process that starts? (PID 1)
systemd
What features does systemd provide in Linux?
- Parallelization (starting multiple services simultaniously).
- On-demand starting of daemons.
- Automatic service dependency management.
- A way of tracking related processes using control groups.
What is a unit in systemd?
A unit is an abstact concept to define objects that the system knows how to manage.
What are unit files?
Configuration files which encapsulate information about system services, listening sockets, and other relevant objects for the systemd init system.
Name the three types of systemd units and their file extensions.
- Service units (.service)
- Socket units (.socket)
- Path units (.path)
What are .service units?
.service units represent system services, and are used to start often accessed daemons, such as a web server.
What are .socket units.
.sockets represent inter-process communications (IPC) that systemd should monitor.
What is a .path unit?
.path units delay the activation of a service until a specific file system change occurs.
What CLI command is used to manage systemd units.
systemctl
What CLI command will list all currently loaded service units?
systemctl list-units --type=service
What CLI command wil list all units regardless of activation state?
systemctl list-units --all
What CLI command will list units that are both loaded and active?
systemctl
What CLI command will list all installed unit files and their state?
systemctl list-unit-files
What CLI command will show the status of a unit?
systemctl status unit.type
What CLI comand will manualy start a system service?
systemctl start unit.type
If the .type is omited from a unit’s name, systemd will assume it’s a . service
What CLI command is used to stop a running service?
systemctl stop name.type
What CLI command will “restart” a running service?
systemctl restart unit.type
Restart will completely stop and restart a service resulting in the service getting a new PID assigned.
What CLI command will “reload” a running system service?
systemctl reload unit.type
Reload will reload a running service without stopping it first, this results in it keeping it’s PID.
What CLI command should you use to reload a service if you are not sure if the service has the option to reload?
systemctl reload-or-restart unit.type
If the service has the ability to reload itself it will, otherwise it will restart.
What CLI command is used to list a systemd unit’s dependencies?
systemctl list-dependencies unit.type
To list the services that depend on a unit add the --reverse
option fl
What CLI command would you use to disable a service and prevent an administrator from accidentaly restarting it?
systemctl mask unit.type
Use systemctl unmask unit.type
to allow a unit to be enabled.
What CLI command would you use to prevent a service from starting at boot?
systemctl disable unit.type
Use systemctl enable unit.type
to make a service start at boot.