RHCSA RHCSA Systemd and Service Management 3 — Questions and Answers
Question 1: Which journalctl option limits output to messages from the current boot only?
- -b (Correct answer)
- --since=boot
- --current
- -k
Correct answer: -b
`journalctl -b` (or `--boot`) shows log entries from the current boot session.
Question 2: A service unit's `ExecStart=` line begins with a `-` (dash) before the command path. What does this mean?
- The command runs with reduced privileges
- A non-zero exit code from the command is ignored (Correct answer)
- The command is executed in a subshell
- The service will restart automatically on failure
Correct answer: A non-zero exit code from the command is ignored
A leading `-` in `ExecStart=` tells systemd to ignore a failure (non-zero exit) of that command.
Question 3: What does the `systemctl isolate rescue.target` command do?
- Reboots the system into rescue mode on next boot
- Immediately switches the running system to rescue.target, stopping all non-essential services (Correct answer)
- Creates a snapshot before entering rescue mode
- Sends SIGTERM to all user processes
Correct answer: Immediately switches the running system to rescue.target, stopping all non-essential services
`systemctl isolate` switches the active target immediately, stopping all units not required by the new target.
Question 4: Where should custom drop-in configuration files for an existing systemd unit be placed?
- /usr/lib/systemd/system/<unit>.d/
- /etc/systemd/system/<unit>.d/ (Correct answer)
- /run/systemd/system/<unit>.conf.d/
- /etc/systemd/conf.d/<unit>/
Correct answer: /etc/systemd/system/<unit>.d/
Drop-in override files go in `/etc/systemd/system/<unit>.d/` as `*.conf` files so they survive package updates.
Question 5: Which `systemctl` command shows the current default boot target?
- systemctl get-default (Correct answer)
- systemctl list-targets --default
- systemctl show default.target
- systemctl target --current
Correct answer: systemctl get-default
`systemctl get-default` prints the symlink destination of `default.target`.
Question 6: A service file has `Restart=on-failure`. Under which condition will systemd NOT restart the service?
- The process exits with code 1
- The process is killed by SIGTERM
- The process exits cleanly with code 0 (Correct answer)
- The process is killed by SIGSEGV
Correct answer: The process exits cleanly with code 0
`Restart=on-failure` only restarts when the process exits with a non-zero code or is killed by a signal; a clean exit (code 0) is not restarted.
Question 7: Which command shows journal logs for `crond.service` since yesterday in reverse chronological order?
- journalctl -u crond.service --since=yesterday -r
- journalctl -u crond.service --since yesterday --reverse (Correct answer)
- journalctl --unit=crond --time yesterday -r
- journalctl -u crond.service -b -1 -r
Correct answer: journalctl -u crond.service --since yesterday --reverse
`journalctl -u crond.service --since yesterday --reverse` filters by unit and date, then reverses output order.
Which journalctl option limits output to messages from the current boot only?