Systemd

https://www.golinuxcloud.com/beginners-guide-systemd-tutorial-linux
Target Group of services, similar to, but more general than, a System V runlevel.
There is a default target which is the group of services that are started at boot time.
Service Daemon that can be started and stopped, very much like a SystemV service.
Unit Configuration file that describes a target, a service, and several other things. Units are text files that contain properties and values.
man systemd.service
man systemd.target
man systemd.unit
man systemd.journal-fields
systemctl list-units
systemctl list-units --type=service
systemctl start httpd.service
systemctl stop httpd.service
systemctl restart httpd.service
systemctl status my_script.service

systemctl start postgresql@18-htest         # @<version>-<cluster>
systemctl enable httpd.service      # The unit will be automatically started at boot time
systemctl disable httpd.service     # Prevents a unit from starting automatically at boot time
systemctl --user stop myapp
systemctl --user disable myapp

systemctl daemon-reload
journalctl -eu caddy
    -u  --unit=UNIT|PATTERN     Show messages for the unit(s)
    -e  --pager-end             Jump to the end of the journal
    -r  --reverse               Reverse output so that the newest entries are displayed first
    -f  --follow                Like tail -f

Units

The basic item of configuration is the unit file.
Unit files are found in three different places:
/etc/systemd/system: Local configuration
/run/systemd/system: Runtime configuration
/lib/systemd/system: Distribution-wide configuration
/usr/lib/systemd/system/: Contains default systemd unit configurations as per contained in the rpm
When looking for a unit, systemd searches the directories in that order, stopping as soon as it finds a match.
=> possible to override the behavior of a distribution-wide unit by placing a unit of the same name in /etc/systemd/system.
To disable a unit completely, create a local file that is empty or linked to /dev/null.

All unit files begin with a section marked [Unit] which contains basic information and dependencies.
Example:
[Unit]
Description=D-Bus System Message Bus
Documentation=man:dbus-daemon(1)
Requires=dbus.socket
Unit dependencies:
Requires A list of units that this unit depends on, which is started when this unit is started
Wants A weaker form of Requires: the units listed are started but the current unit is not stopped if any of them fail
Conflicts A negative dependency: the units listed are stopped when this one is started and, conversely, if one of them is started, this one is stopped

Before and After determine the order in which they are started.
The order of stopping is just the reverse of the start order.
BeforeThis unit should be started before the units listed
AfterThis unit should be started after the units listed
In the absence of Before or After directives, the units will be started or stopped in parallel with no particular ordering.

Services

A service is a daemon that can be started and stopped, equivalent to a System V service. for example, lighttpd.service.
A service unit has a [Service] section that describes how it should be run. Here is the relevant section from lighttpd.service:
[Service]
ExecStart=/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -D
ExecReload=/bin/kill -HUP $MAINPID

Target

A target is another type of unit which groups services (or other types of unit).
It is a type of unit that only has dependencies.
Targets have names ending in .target, for example, multi-user.target.
A target is a desired state, which performs the same role as System V runlevels.