Systemd
Notes// archive From the original Code Walker docs. Kept for reference, so some versions and commands may be out of date.
The systemd daemon manages start-up for Linux, including service start-up and service management in general. It activates system resources, server daemons, and other processes both at boot time and on a running system.
In RHEL, the first process that starts (PID 1) is systemd.
systemd uses units to manage different types of objects. Service units have a .service extension, socket units have a .socket extension and path units have a .path extension.
Use the systemctl command to manage units.
systemctl list-units --type=service --allUse status to view the status of a specific unit:
systemctl status sshdUse start, stop and restart to control services:
systemctl start sshd
systemctl restart sshd
systemctl stop sshdMasking a service prevents an administrator from accidentally starting a service that conflicts with others.
systemctl mask sendmail.serviceEnable services to ensure services automatically start when a system reboots.
systemctl enable sshdTo see the enabled or disabled states of all service units:
systemctl list-unit-files --type=servicesystemctl poweroff stops all running services, unmounts all file systems and then powers down the system. systemctl reboot stops all running services, unmounts all file systems, and then reboots the system.
You can also use the shorter version of these commands, poweroff and reboot, which are symbolic links to their systemctl equivalents.
A systemd target is a set of systemd units that the system should start to reach the desired state.
Commonly used targets include graphical.target and multi-user.target for text-based logins.
Change to a target runtime:
systemctl isolate multi-user.targetSet the defualt:
systemctl get-default
systemctl set-default multi-user.targetSummary
Use the systemctl status command to determine the status of system daemons and network services started by systemd.
The systemctl list-dependencies command lists all service units upon which a specific service unit depends.
reboot and poweroff reboot and power down a system, respectively.
systemctl isolate OPTION.target switches to a new target at runtime.
Use systemctl get-default and systemctl set-default to query and set the default target.
Command References:
systemd, systemd.unit, systemd.service, systemd.socket and systemctl.