Question 260
An application unit already orders startup with After=database.service. Which additional directive pulls the database unit into the transaction and makes the application depend on successful database activation?
- .target unit
- ExecStart=/usr/local/bin/worker
- Requires=database.service
- data.mount
- .timer unit
- Wants=logger.service
Explanation
Correct Answer
C:Requires adds a strong dependency on the named unit, with failure propagation under the applicable startup conditions. Ordering may separately require After.
Incorrect Answers
A:A target groups and synchronizes systemd units to express boot states; the requirement is expressing a mandatory unit dependency, outside the effect of this choice.
B:ExecStart defines the command systemd launches for a service; it does not deliver expressing a mandatory unit dependency, which is decisive in this scenario.
D:systemd converts mount-point paths into unit names such as data.mount; the task involves expressing a mandatory unit dependency, whereas this addresses another subsystem.
E:A timer unit activates an associated service on its configured schedule; its scope differs from expressing a mandatory unit dependency, so it cannot meet the stated requirement.
F:Wants is a weaker activation dependency than Requires; that is not equivalent to expressing a mandatory unit dependency.
Question 261
A systemd service must start immediately but not change its boot enablement. Which command is correct?
- systemctl daemon-reload
- systemctl enable app.service
- systemctl restart app.service
- systemctl start app.service
Explanation
Correct Answer
D:start activates the unit now without writing enablement symlinks. It has no implication that the service will run after a reboot.
Incorrect Answers
A:daemon-reload refreshes systemd manager configuration and dependency state; that is not equivalent to activating a service in the current boot.
B:enable creates the installation symlinks needed to pull in a unit at startup; the administrator instead needs activating a service in the current boot; this option serves a different purpose.
C:restart stops and starts the unit, causing its main process to reinitialize; it answers a neighboring question rather than activating a service in the current boot.
Question 262
A .service file should run /usr/local/bin/worker as its principal process. Which directive specifies that executable?
- ExecStart=/usr/local/bin/worker
- After=database.service
- Restart=on-failure
- network-online.target
Explanation
Correct Answer
A:ExecStart defines the command systemd launches for a service. Service Type settings determine how its startup lifecycle is tracked.
Incorrect Answers
B:After controls relative startup ordering when both units participate in a transaction; using it would leave defining the program launched by a service unit unresolved.
C:Restart=on-failure restarts a service after selected failure conditions; the requirement is defining the program launched by a service unit, outside the effect of this choice.
D:network-online.target denotes an online network condition only when the distribution's wait-online services provide it. network.target alone does not promise usable connectivity; it does not deliver defining the program launched by a service unit, which is decisive in this scenario.
Question 263
A stopped service should no longer start automatically at boot but remain manually startable. Which action fits?
- systemctl enable app.service
- systemctl daemon-reload
- systemctl disable app.service
- systemctl restart app.service
Explanation
Correct Answer
C:disable removes symlinks created by enablement while leaving the unit available for explicit starts. It does not necessarily stop a currently running instance.
Incorrect Answers
A:enable creates the installation symlinks needed to pull in a unit at startup; the task involves removing automatic service startup without masking, whereas this addresses another subsystem.
B:daemon-reload refreshes systemd manager configuration and dependency state; its scope differs from removing automatic service startup without masking, so it cannot meet the stated requirement.
D:restart stops and starts the unit, causing its main process to reinitialize; the administrator instead needs removing automatic service startup without masking; this option serves a different purpose.
Question 264
A service should wait until the network is considered online rather than merely when network management starts. Which dependency target is commonly relevant?
- .target unit
- ExecStart=/usr/local/bin/worker
- After=database.service
- network-online.target
Explanation
Correct Answer
D:For units requiring configured network reachability, network-online.target can act as an ordering point with a suitable wait-online service. network.target alone does not promise usable connectivity.
Incorrect Answers
A:A target groups and synchronizes systemd units to express boot states; that changes a different part of the system; the requested outcome is depending on a network-ready boot milestone.
B:ExecStart defines the command systemd launches for a service; this does not achieve depending on a network-ready boot milestone on the system described.
C:After controls relative startup ordering when both units participate in a transaction; it will not provide depending on a network-ready boot milestone under these conditions.
Question 265
A server must mount /data via a systemd unit whose name corresponds to that path. Which unit name is generated?
- Restart=on-failure
- data.mount
- After=database.service
- Requires=database.service
- WantedBy=multi-user.target
Explanation
Correct Answer
B:systemd converts mount-point paths into unit names such as data.mount. The mount unit models the mounted filesystem and its dependencies.
Incorrect Answers
A:Restart=on-failure restarts a service after selected failure conditions; it does not deliver naming a mount unit for /data, which is decisive in this scenario.
C:After controls relative startup ordering when both units participate in a transaction; the task involves naming a mount unit for /data, whereas this addresses another subsystem.
D:Requires adds a strong dependency on the named unit, with failure propagation under the applicable startup conditions; its scope differs from naming a mount unit for /data, so it cannot meet the stated requirement.
E:An install directive such as WantedBy defines the target's enablement symlink; that is not equivalent to naming a mount unit for /data.
Question 266
A custom service should restart after an unexpected failure but not after a normal administrative stop. Which setting is suitable?
- Restart=on-failure
- Wants=logger.service
- Requires=database.service
- network-online.target
Explanation
Correct Answer
A:Restart=on-failure restarts a service after selected failure conditions. Explicit stops and clean exits are generally not considered failures.
Incorrect Answers
B:Wants is a weaker activation dependency than Requires; it answers a neighboring question rather than restarting a failed service automatically.
C:Requires adds a strong dependency on the named unit, with failure propagation under the applicable startup conditions; that changes a different part of the system; the requested outcome is restarting a failed service automatically.
D:A network-online.target dependency affects startup ordering when a wait-online implementation is active; it does not replace a restart policy. network.target alone does not promise usable connectivity; this does not achieve restarting a failed service automatically on the system described.
Question 267
The team wants to find which unit startup operations consumed the longest wall-clock time. Which command lists them?
- hostnamectl set-hostname app01
- systemd-analyze blame
- timedatectl status
- systemd-analyze time
Explanation
Correct Answer
B:systemd-analyze blame ranks unit activation durations. It does not always identify the true critical path, because many units can start concurrently.
Incorrect Answers
A:hostnamectl configures host naming through systemd-hostnamed on supported systems; using it would leave ranking slow unit activations unresolved.
C:timedatectl reports local time, time zone and synchronization indicators under systemd; it does not deliver ranking slow unit activations, which is decisive in this scenario.
D:systemd-analyze time reports time spent in firmware, loader, kernel and userspace where available; the evidence calls for ranking slow unit activations, not merely this separate operation.
Question 268
A change manager needs to see whether a unit is running, failed or inactive, including recent log lines. Which command provides a summary?
- systemctl status app.service
- systemctl start app.service
- systemctl daemon-reload
- systemctl mask app.service
Explanation
Correct Answer
A:status combines unit state with process and recent journal information. It is for inspection, not a promise of future enablement.
Incorrect Answers
B:start activates the unit now without writing enablement symlinks; that is not equivalent to checking service runtime state and recent failures.
C:daemon-reload refreshes systemd manager configuration and dependency state; the administrator instead needs checking service runtime state and recent failures; this option serves a different purpose.
D:Masking links the unit name to /dev/null, preventing normal activation by systemd; it answers a neighboring question rather than checking service runtime state and recent failures.
Question 269
A service should pull in a logging helper when available without failing if the helper cannot start. Which relationship is appropriate?
- Restart=on-failure
- .timer unit
- network-online.target
- Wants=logger.service
Explanation
Correct Answer
D:Wants is a weaker activation dependency than Requires. It starts the related unit but generally does not require it to succeed.
Incorrect Answers
A:Restart=on-failure restarts a service after selected failure conditions; this does not achieve declaring an optional activation dependency on the system described.
B:A timer unit activates an associated service on its configured schedule; it will not provide declaring an optional activation dependency under these conditions.
C:network-online.target can delay dependent unit startup for network readiness, provided a working online-wait service is present. network.target alone does not promise usable connectivity; using it would leave declaring an optional activation dependency unresolved.
Question 270
A server clock is wrong, and the operator needs to check time zone and NTP synchronization state. Which command reports both?
- hostnamectl set-hostname app01
- systemd-analyze time
- timedatectl status
- systemd-analyze blame
Explanation
Correct Answer
C:timedatectl reports local time, time zone and synchronization indicators under systemd. It does not replace an NTP daemon's detailed peer statistics.
Incorrect Answers
A:hostnamectl configures host naming through systemd-hostnamed on supported systems; the evidence calls for inspecting system time-zone and synchronization settings, not merely this separate operation.
B:systemd-analyze time reports time spent in firmware, loader, kernel and userspace where available; the task involves inspecting system time-zone and synchronization settings, whereas this addresses another subsystem.
D:systemd-analyze blame ranks unit activation durations; that is not equivalent to inspecting system time-zone and synchronization settings.