Manage Services and Processes in RHEL 10 With systemd
Manage services and processes in RHEL 10: systemctl, drop-ins, unit files, resource limits, journalctl, timers, ps, signals and troubleshooting steps.
RHEL 10 manages services with systemd, so day-to-day work is systemctl for units, journalctl for logs, drop-in overrides for changes, and ps, top and signals for processes. Start, stop, enable and mask services with systemctl, change them with systemctl edit, and limit resources with unit directives such as MemoryMax and CPUQuota.
This is a working guide for administrators who already have a RHEL 10 machine running. If you are still installing, begin with setting up RHEL 10 for the first time, which is the pillar for this series. Disks and file systems have their own walkthrough in the RHEL 10 storage administration tutorial. Here we stay on services and processes. Commands were checked against the systemd manual pages in November 2026. RHEL 10.2 (released 19 May 2026) is the latest minor release listed on Red Hat's release page.
Key takeaways
systemctl enableonly creates the boot-time links. Add--nowto start the unit as well.- Use
systemctl edit <unit>for changes. It writes a drop-in file, so package updates do not overwrite your settings. reloadasks the service to re-read its own configuration.daemon-reloadmakes systemd re-read unit files. They are not the same.masklinks a unit to/dev/nullso nothing can start it, even as a dependency.- Prefer
SIGTERMbeforeSIGKILL, and usesystemctl killorstopfor services that systemd owns. - Resource limits belong in the unit (
MemoryMax,CPUQuota,TasksMax), not in ad hoc scripts.
How systemd organises work
systemd is the first process (PID 1). It reads unit files and runs them in dependency order. The units you meet most are services (.service), timers (.timer), sockets (.socket) and targets (.target, groups of units such as multi-user.target).
| Location | Purpose |
|---|---|
/usr/lib/systemd/system/ | Units installed by packages. Do not edit these. |
/etc/systemd/system/ | Administrator units and drop-ins. This overrides the package copy. |
/run/systemd/system/ | Runtime units that vanish at reboot |
Each service runs in its own control group (cgroup), which is why systemd can stop a service and everything it spawned. You can see the tree with systemd-cgls and live usage with systemd-cgtop.
Inspect services
systemctl status sshd # state, recent log lines, main PID, cgroup
systemctl is-active sshd # active, inactive, failed
systemctl is-enabled sshd # enabled, disabled, masked, static
systemctl list-units --type=service --state=running
systemctl list-units --failed # same as --state=failed
systemctl list-unit-files --type=service
systemctl cat sshd # unit file plus any drop-ins on disk
systemctl list-dependencies sshd
is-active, is-enabled and is-failed return exit codes, so scripts and Ansible tasks can branch on them without parsing text. systemctl cat shows what is on disk, which can differ from what systemd has loaded if you have not run daemon-reload.
Start, stop and enable
sudo systemctl start httpd
sudo systemctl stop httpd
sudo systemctl restart httpd # stop, then start
sudo systemctl try-restart httpd # only if already running
sudo systemctl reload httpd # service re-reads its own config
sudo systemctl reload-or-restart httpd # reload if supported, else restart
sudo systemctl enable --now httpd # start at boot and start now
sudo systemctl disable --now httpd # remove boot link and stop now
sudo systemctl mask httpd # block all activation
sudo systemctl unmask httpd
Two points catch people out. First, a plain enable does not start anything. Second, disable does not stop the unit and does not stop another unit from pulling it in as a dependency. Only mask does that. If you want to confirm a web service after enabling, our guide to setting up Apache on RHEL 10 uses exactly these commands.
Allow traffic after starting a service
Starting a daemon does not open the firewall. Use firewalld for that, as covered in the RHEL 10 firewalld commands guide. Also check that the process listens where you expect:
sudo ss -tulpn | grep httpd
Change a service safely with drop-ins
Never edit files under /usr/lib/systemd/system/. A package update would replace your change. systemctl edit opens an editor and saves to /etc/systemd/system/<unit>.d/override.conf:
sudo systemctl edit httpd
# In the editor, add only what you want to change:
# [Service]
# Restart=on-failure
# RestartSec=5s
sudo systemctl restart httpd
systemctl cat httpd
systemctl edit --full replaces the whole unit file instead of adding a fragment. Use it only when a drop-in cannot express the change. An empty temporary file cancels the edit. If you change unit files by hand rather than through edit, run sudo systemctl daemon-reload so systemd rebuilds its dependency tree. The man page defines it as re-running generators, reloading all unit files and rebuilding dependencies.
Write a unit for your own service
A minimal unit for an application you run from /opt/app:
[Unit]
Description=Orders API
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=orders
Group=orders
WorkingDirectory=/opt/app
ExecStart=/opt/app/bin/orders-api --port 8080
Restart=on-failure
RestartSec=5s
# Hardening
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ReadWritePaths=/var/lib/orders
[Install]
WantedBy=multi-user.target
Save it as /etc/systemd/system/orders-api.service, then run:
sudo systemctl daemon-reload
sudo systemctl enable --now orders-api
systemd-analyze verify /etc/systemd/system/orders-api.service
systemd-analyze security orders-api
systemd-analyze verify catches typos before you start the service, and systemd-analyze security scores how exposed the unit is, which tells you which hardening directives to add next. On RHEL, SELinux also confines services, so a new binary in a non-standard path may start under the wrong context. The SELinux in RHEL 10 guide explains ps -eZ, restorecon and how to read denials.
Limit CPU, memory and tasks
systemd exposes cgroup controls as unit directives. The systemd documentation defines the common ones this way:
| Directive | Meaning |
|---|---|
CPUWeight= | Relative CPU share against other units in the same slice. Range 1 to 10000, default 100. |
CPUQuota= | Cap as a percentage of one CPU. 200% allows two CPUs. |
MemoryHigh= | Throttling threshold. The unit is slowed heavily above it. |
MemoryMax= | Hard limit. If usage cannot be contained, the OOM killer acts inside the unit. |
TasksMax= | Maximum tasks the unit may create. Threads count individually. |
IOWeight= | Relative block I/O share, 1 to 10000, default 100. |
# Apply to a running service, persisted as a drop-in
sudo systemctl set-property orders-api.service MemoryHigh=800M MemoryMax=1G CPUQuota=150%
# Apply until the next reboot only
sudo systemctl set-property --runtime orders-api.service CPUQuota=50%
# Try a limit on a one-off command
sudo systemd-run --scope -p MemoryMax=500M -p CPUQuota=50% ./batch-job.sh
systemctl show orders-api -p MemoryMax -p CPUQuota
Set MemoryHigh below MemoryMax. The documentation calls MemoryHigh the main mechanism for controlling memory and MemoryMax the last line of defence. Old directives such as CPUShares= and MemoryLimit= are deprecated, so avoid copying them from older posts.
Logs with journalctl
journalctl -u orders-api # all entries for the unit
journalctl -u orders-api -b # since this boot
journalctl -u orders-api -f # follow live
journalctl -u orders-api --since "1 hour ago" -p err
journalctl -b -1 -p warning # previous boot, warnings and worse
journalctl -k # kernel messages
journalctl -o json -n 5 # machine-readable
journalctl --disk-usage
sudo journalctl --vacuum-time=14d
sudo journalctl --vacuum-size=500M
If -b -1 shows nothing, your journal is probably not persistent. Setting Storage=persistent in /etc/systemd/journald.conf keeps logs across reboots. For rotation, forwarding and retention policy, read RHEL 10 log management best practices.
Timers instead of cron
A timer starts the service with the same name. backup.timer starts backup.service.
# /etc/systemd/system/backup.timer
[Unit]
Description=Nightly backup
[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true
RandomizedDelaySec=10min
[Install]
WantedBy=timers.target
sudo systemctl enable --now backup.timer
systemctl list-timers
systemd-analyze calendar "*-*-* 02:00:00"
Persistent=true saves the last trigger time, so a run missed while the machine was off happens at next boot. It only applies to OnCalendar= timers. AccuracySec defaults to one minute, meaning the run can land anywhere in that window. If the service is still running when the timer fires again, it is not restarted. Timers also give you journal logs per run, which cron does not.
Targets and boot analysis
systemctl get-default
sudo systemctl set-default multi-user.target # text mode, typical for servers
sudo systemctl isolate rescue.target # switch now (disruptive)
systemd-analyze # total boot time
systemd-analyze blame # slowest units
systemd-analyze critical-chain sshd.service
isolate stops everything not part of the target, so only run it with console access. Use critical-chain to see what a slow boot is waiting on.
Manage processes
Find and read them
ps aux --sort=-%mem | head
ps -eo pid,ppid,user,stat,%cpu,%mem,etime,cmd --sort=-%cpu | head
ps -eZ | grep httpd # SELinux context
pgrep -a nginx
pstree -p $(pgrep -o sshd)
top -o %MEM # sort by memory
ss -tulpn # who owns which port
sudo lsof -p 1234 | head
The STAT column tells you what a process is doing: R running, S sleeping, D uninterruptible I/O wait, T stopped, Z zombie. A zombie is a finished process whose parent has not collected its exit status. You cannot kill it. Fix or restart the parent. A long-lived D state usually points to storage or NFS trouble, so check the NFS server and client setup or your disks. For more on watching load, see monitoring active processes with ps, top and htop and analysing CPU and memory usage.
Signals
| Signal | Number | Use |
|---|---|---|
| SIGTERM | 15 | Polite shutdown. This is the default for kill. Try this first. |
| SIGHUP | 1 | Many daemons re-read configuration when they get it |
| SIGINT | 2 | Interrupt, the same as Ctrl+C |
| SIGKILL | 9 | Cannot be caught. Use it last, because the process gets no chance to clean up. |
| SIGSTOP / SIGCONT | 19 / 18 on x86_64 | Pause and resume |
kill 1234 # SIGTERM
kill -HUP 1234
kill -KILL 1234 # last resort
pkill -u alice sleep
sudo systemctl kill --signal=SIGHUP orders-api # signal via systemd
sudo systemctl kill -s SIGKILL orders-api
For anything started by systemd, stop it through systemd. If you kill the main process with kill, a unit with Restart=on-failure may bring it straight back, which looks like the kill did not work.
Priority
nice -n 10 ./report.sh # start with lower priority
sudo renice -n 5 -p 1234 # change a running process
ionice -c3 -p 1234 # idle I/O class
Niceness runs from -20 (highest priority) to 19 (lowest). Only root can lower the number. For services, prefer CPUWeight and IOWeight in the unit, since they are applied per cgroup and survive restarts.
When the kernel kills a process
sudo journalctl -k | grep -i -E "out of memory|oom"
systemctl status orders-api # look for "code=killed, signal=KILL"
If the cause is a cgroup limit you set, the message names the cgroup. Raise MemoryMax only after you have confirmed the process is not leaking.
A troubleshooting routine for a failed service
systemctl status <unit>for the exit code and the last log lines.journalctl -u <unit> -b -p warningfor the full story since boot.systemctl cat <unit>to see the unit and drop-ins on disk, andsystemd-analyze verifyfor syntax.- Run
ExecStartby hand as the service user to see the real error. - Check SELinux denials and file permissions, then the firewall and the listening socket.
- If the unit hits its start limit, fix the cause and clear it with
systemctl reset-failed <unit>.
If you want guided practice on these tasks with a lab, our RHCSA training in Pune and live online covers service and process management, and the broader Linux administration course builds on it. For exam context see the RHEL 10 RHCSA exam guide.
Frequently asked questions
What is the difference between enable and start in systemctl?
start runs the service now. enable creates the links so it starts at boot. Use enable --now to do both.
What does systemctl mask do?
It links the unit to /dev/null, so it cannot be started manually or by a dependency until you unmask it.
When do I need systemctl daemon-reload?
After you create or edit unit files by hand. It reloads all unit files and rebuilds the dependency tree. systemctl edit does this for you.
How do I see logs for one service?
Run journalctl -u <unit>, add -b for the current boot, -f to follow, and -p err for errors only.
How do I limit memory for a service in RHEL 10?
Use systemctl set-property <unit> MemoryHigh=... MemoryMax=..., or put the directives in a drop-in created with systemctl edit.
Why does a killed service come back?
The unit probably has Restart=on-failure or Restart=always. Stop it with systemctl stop instead of killing the PID.
Can I kill a zombie process?
No, it is already dead. Its parent has not reaped it. Restart or fix the parent process.
Should I use cron or systemd timers on RHEL 10?
Both work. Timers give per-run journal logs, Persistent= catch-up for missed runs, and dependency control. Cron is simpler for one-line jobs.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0