Courseiva
hardMultiple Choice

XK0-006 Practice Question: A Linux server runs a critical service managed by…

A Linux server runs a critical service managed by a systemd service unit. The administrator needs to configure the service to automatically restart if it crashes, but only up to 3 times within a 30-second window. If the service restarts more than 3 times in 30 seconds, systemd should stop attempting to restart and leave the service in a failed state. Which set of directives should be added to the [Service] section of the unit file to achieve this behavior?

⚠ Common exam trap

A common mix-up: candidates confuse `Restart=always` (which restarts on any exit, including intentional stops) with `Restart=on-failure` (which only restarts on crashes), or they misremember the default values of `StartLimitBurst` and `StartLimitIntervalSec`, leading them to pick options with incorrect burst counts or intervals.

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

✓

`Restart=on-failure` and `StartLimitBurst=3` and `StartLimitIntervalSec=30`

It uses `Restart=on-failure` to trigger a restart only when the service crashes (not on other stops), combined with `StartLimitBurst=3` and `StartLimitIntervalSec=30` to limit restarts to 3 attempts within a 30-second window. When the burst limit is exceeded, systemd automatically places the unit in a failed state, exactly matching the requirement.

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=on-abort` and `MaxStartups=3`

    Why it's wrong here

    MaxStartups is an sshd directive limiting concurrent unauthenticated connections, not a systemd restart cap; systemd ignores it in a unit file. Restart=on-abort also omits clean-exit failures. StartLimitIntervalSec and StartLimitBurst in [Unit] provide the 30-second, three-attempt throttling the scenario requires.

  • ✗

    `Restart=on-failure` and `StartLimitBurst=5` and `StartLimitIntervalSec=60`

    Why it's wrong here

    StartLimitBurst=5 and StartLimitIntervalSec=60 permit five restarts per 60 seconds, not three per 30, so the threshold is wrong. These directives are the right mechanism for rate-limiting restarts, but the values must match the stated three-in-30-seconds requirement.

  • ✗

    `Restart=always` and `RestartSec=10`

    Why it's wrong here

    RestartSec=10 sets a fixed delay between restarts and Restart=always lacks any burst limit, so systemd would retry indefinitely rather than stop after three attempts in 30 seconds. This pairing suits services needing persistent restart with a cooldown, not rate-limited failure.

  • ✓

    `Restart=on-failure` and `StartLimitBurst=3` and `StartLimitIntervalSec=30`

    Why this is correct

    Restart=on-failure triggers restarts after abnormal exit. StartLimitBurst=3 caps restarts at three, while StartLimitIntervalSec=30 defines the 30-second window in which those restarts are counted. Exceeding the burst within that interval makes systemd stop restarting and leave the unit failed.

About these practice questions

One of 781 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This XK0-006 practice question is part of Courseiva's free CompTIA 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 XK0-006 exam.