Courseiva
Administrative TaskshardMultiple ChoiceObjective-mapped

LPIC-1 Administrative Tasks Practice Question

A systemd service unit file must be configured to automatically restart the service if it exits unexpectedly. Which directive should be used?

⚠ Common exam trap

It's easy for candidates to confuse `Restart=always` with `Type=forking` or `RemainAfterExit=yes`, mistakenly thinking these directives handle automatic restarts, when in fact they address process forking or service state after exit.

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=always

The `Restart=always` directive in a systemd service unit file instructs systemd to automatically restart the service regardless of the exit status, including unexpected crashes or terminations. This ensures high availability by restarting the process whenever it exits, unless explicitly stopped by systemctl. Other directives like `Type=forking` or `RemainAfterExit=yes` do not control restart behavior.

Answer analysis

Option-by-option breakdown

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

  • Type=forking

    Why it's wrong here

    This defines the service type, not restart behavior.

  • Restart=always

    Why this is correct

    This directs systemd to restart the service automatically after it stops, regardless of exit status.

  • RemainAfterExit=yes

    Why it's wrong here

    This indicates the service is considered active even after its main process exits, but does not restart.

  • ExecStop=/bin/true

    Why it's wrong here

    This specifies a command to run when stopping the service, not related to restart.

About these practice questions

This LPIC-1 question is part of Courseiva's 527-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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.