RHCSA RHCSA Systemd and Service Management 2 — Questions and Answers
Question 1: Which systemctl command shows all unit files installed on the system, regardless of their state?
- systemctl list-units
- systemctl list-unit-files (Correct answer)
- systemctl status --all
- systemctl show --all
Correct answer: systemctl list-unit-files
`systemctl list-unit-files` lists all installed unit files and their enabled/disabled state.
Question 2: A service unit has `WantedBy=multi-user.target`. What does enabling this service actually create?
- A symlink in /etc/systemd/system/multi-user.target.wants/ (Correct answer)
- A copy of the unit file in /run/systemd/
- An entry in /etc/rc.local
- A hard link in /usr/lib/systemd/system/
Correct answer: A symlink in /etc/systemd/system/multi-user.target.wants/
`systemctl enable` creates a symlink in the target's `.wants/` directory under `/etc/systemd/system/`.
Question 3: Which directive in a systemd service unit file prevents the service from starting until the network is fully online?
- Requires=network.target
- After=network-online.target Wants=network-online.target (Correct answer)
- Before=network.target
- BindsTo=network.service
Correct answer: After=network-online.target Wants=network-online.target
`After=network-online.target` combined with `Wants=network-online.target` ensures the service waits for full network availability.
Question 4: What is the effect of running `systemctl mask httpd`?
- Disables httpd and removes its unit file
- Creates a symlink from the unit file to /dev/null, preventing it from starting (Correct answer)
- Stops httpd and marks it as failed
- Moves the unit file to a backup directory
Correct answer: Creates a symlink from the unit file to /dev/null, preventing it from starting
Masking creates a symlink to `/dev/null`, making it impossible to start the service even manually.
Question 5: Which command displays the dependency tree for the `sshd.service` unit?
- systemctl show sshd.service --deps
- systemctl list-dependencies sshd.service (Correct answer)
- systemctl status sshd.service --tree
- journalctl -u sshd.service --tree
Correct answer: systemctl list-dependencies sshd.service
`systemctl list-dependencies` shows all units that a given unit depends on in a tree format.
Question 6: A systemd timer unit should run a job every day at 02:30. Which `OnCalendar=` value is correct?
- daily 02:30
- *-*-* 02:30:00 (Correct answer)
- 0 2 30 * *
- 02:30:00 daily
Correct answer: *-*-* 02:30:00
The systemd calendar format for daily at 02:30 is `*-*-* 02:30:00` (year-month-day hour:minute:second).
Question 7: Which command reloads systemd's configuration without rebooting after you add a new unit file?
- systemctl reload
- systemctl restart systemd
- systemctl daemon-reload (Correct answer)
- systemctl refresh
Correct answer: systemctl daemon-reload
`systemctl daemon-reload` rescans all unit files and reloads systemd's configuration in place.
Which systemctl command shows all unit files installed on the system, regardless of their state?