Courseiva
Service ConfigurationeasyMultiple SelectObjective-mapped

LFCS Service Configuration Practice Question

A system administrator needs to ensure that a custom service named 'myapp.service' starts automatically after a reboot and also restarts automatically no matter how the service stops, even if it exits normally. Which two actions should the administrator take? (Choose two.)

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

Run 'systemctl enable myapp.service' to enable the service.

To start automatically on boot, the service must be enabled via 'systemctl enable'. To restart on any exit, 'Restart=always' must be set in the service file. 'Restart=on-failure' does not cover normal exits; 'After' and 'mask' are irrelevant.

Answer analysis

Option-by-option breakdown

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

  • Run 'systemctl mask myapp.service' to prevent manual stops.

    Why it's wrong here

    Masking prevents the service from being started at all.

  • Run 'systemctl enable myapp.service' to enable the service.

    Why this is correct

    Correct: Enabling creates symlinks for automatic start at boot.

  • Set 'Restart=on-failure' in the [Service] section of the service file.

    Why it's wrong here

    This only restarts on failure, not on normal exit.

  • Set 'Restart=always' in the [Service] section of the service file.

    Why this is correct

    Correct: Restart=always makes the service restart regardless of exit reason.

  • Add 'After=network.target' to the [Unit] section of the service file.

    Why it's wrong here

    This only ensures ordering, not auto-start or restart.

About these practice questions

This LFCS question is part of Courseiva's 507-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 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.