systemd Service, Target, and Timer Management
In Red Hat Enterprise Linux 9 (RHEL 9), systemd is PID 1, responsible for initializing the user space and managing all background daemons, mount units, and hardware events.
Core Commands for RHCSA
1. Service Lifecycle Management
# Check service status, active state, and recent logs
systemctl status httpd
# Start, stop, and restart a service
systemctl start httpd
systemctl stop httpd
systemctl restart httpd
# Reload configuration without dropping client connections
systemctl reload httpd
# Enable daemon to launch automatically upon boot and start immediately
systemctl enable --now httpd
# Mask a service to prevent manual or dependency-triggered startup
systemctl mask firewalld
systemctl unmask firewalld
2. Boot Targets (Runlevels)
RHEL 9 organizes system states into targets:
multi-user.target: Console multi-user environment with networking (equivalent to SysV runlevel 3).graphical.target: Full graphical desktop environment (equivalent to SysV runlevel 5).rescue.target: Single-user maintenance environment with local filesystems mounted.emergency.target: Minimal shell with read-only root and initramfs environment.
# View currently active default boot target
systemctl get-default
# Set default target to text console for server performance
systemctl set-default multi-user.target
# Switch to a target immediately without rebooting
systemctl isolate multi-user.target
3. Log Inspection with journalctl
# View logs for a specific service since last system boot
journalctl -u httpd -b
# Follow live output in real-time
journalctl -f -u sshd
# Filter logs by priority (err, warning, info)
journalctl -p err -b
4. Scheduled Jobs: systemd Timers vs cron
# List all active timer units
systemctl list-timers --all
For RHCSA tasks, timer units consist of a .service file describing the task and a .timer file specifying the schedule (OnCalendar=*--* 02:00:00).
Cross-reference: See Root Password Recovery and System Troubleshooting (rd.break) for booting into single-user recovery targets.