Courseiva
Service Configuration →hardMultiple Select

LFCS Service Configuration Practice Question

A Linux administrator is configuring a systemd service unit for a database application. The administrator needs to ensure that the service is automatically restarted if it crashes, but only after a 10-second delay, and that the restart is not attempted if the service is explicitly stopped by an administrator. Which two directives should be used in the [Service] section to achieve these requirements? (Choose two.)

⚠ Common exam trap

The trap here is selecting Restart=always, which seems to ensure restarts but also restarts the service after an administrator intentionally stops it, contrary to the requirement.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

RestartSec=10

To automatically restart a service after a crash but not after an explicit stop, Restart=on-failure is the appropriate setting because it restarts only on abnormal termination. To introduce a 10-second delay before each restart attempt, RestartSec=10 is used. Together, these directives ensure the service restarts after crashes with a delay, but remains stopped when an administrator issues systemctl stop. Other options either restart too broadly or do not control the delay.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Restart=always

    Why it's wrong here

    Restart=always would restart the service regardless of how it exited, including when an administrator explicitly stops it with systemctl stop. This violates the requirement that the service should not restart after an explicit stop. Therefore, this directive is incorrect for the given scenario.

  • ✓

    RestartSec=10

    Why this is correct

    RestartSec=10 sets the delay between the service stopping and systemd attempting to restart it. This directly satisfies the requirement for a 10-second delay before restart. It works in conjunction with Restart= to control the timing of automatic restarts, making it the second correct directive for this scenario.

  • ✗

    StartLimitIntervalSec=10

    Why it's wrong here

    StartLimitIntervalSec defines the time window for rate limiting start attempts. It does not control the delay between restarts. While it can be used to limit restart bursts, it does not provide the 10-second delay required before each restart attempt. Therefore, it does not meet the scenario's requirement for a 10-second restart delay.

  • ✓

    Restart=on-failure

    Why this is correct

    Restart=on-failure configures systemd to restart the service only when it exits with a non-zero exit code, is terminated by a signal, or times out. It does not restart if the service is stopped cleanly by an administrator using systemctl stop. This matches the requirement to restart on crash but not on explicit stop, making it a correct choice.

  • ✗

    RestartPreventExitStatus=0

    Why it's wrong here

    RestartPreventExitStatus specifies exit codes that should prevent a restart, even if Restart= is set. Setting it to 0 would prevent restarts on successful exit, but the scenario requires preventing restarts on explicit stop, which is not governed by exit status. This directive is not relevant to the requirement and would not achieve the desired behavior.

About these practice questions

This LFCS question is part of Courseiva's 406-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Linux Foundation exam blueprint

This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.