easyMultiple ChoiceObjective-mapped
XK0-006 Practice Question: Refer to the exhibit
Exhibit
Refer to the exhibit. ``` [Unit] Description=Daily Backup Service Requires=network-online.target [Service] Type=oneshot ExecStart=/usr/local/bin/backup.sh [Install] WantedBy=multi-user.target ```
Refer to the exhibit. An administrator creates this systemd unit file for a backup script. When the administrator runs `systemctl start backup.service`, the script runs but the service shows 'inactive (dead)' immediately. What change should be made to keep the service active until the script finishes?
⚠ Common exam trap
Watch out — candidates often confuse 'RemainAfterExit' with service types like 'forking' or 'simple', mistakenly thinking changing the type will keep the service active, when in fact only 'RemainAfterExit' explicitly tells systemd to remain active after the process exits.
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
✓
Add 'RemainAfterExit=yes' to the [Service] section
Adding 'RemainAfterExit=yes' to the [Service] section tells systemd to consider the service as active even after the main process (the backup script) exits. Without this directive, systemd sees the process terminate and immediately marks the service as 'inactive (dead)', even though the script may still be running or its effects are ongoing. This is the standard way to keep a service unit in an 'active' state after the main command completes.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Add 'RemainAfterExit=yes' to the [Service] section
Why this is correct
RemainAfterExit=yes keeps the service in 'active' state even after the process exits, which is what the administrator wants.
- ✗
Change the service type to 'forking'
Why it's wrong here
Type=forking expects the process to fork and the parent to exit, which is not the case here.
- ✗
Add 'ExecStop' to the service definition
Why it's wrong here
ExecStop is for commands to run on stop, not for keeping the service active.
- ✗
Change the service type to 'simple'
Why it's wrong here
Type=simple would also show active only while the process runs, but after completion it becomes inactive, same issue.
Go deeper
Related to this question
Learn chapter
File Permissions and Ownership
Key term
Service
A service is a software component or system that performs a specific function and is available to be used by other programs or users over a network.
Key term
Process
In IT service management, a process is a structured set of activities designed to accomplish a specific objective, such as managing incidents or changes, by transforming inputs into defined outputs.
About these practice questions
One of 979 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 →
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.