LFCS Service Configuration Practice Question
An administrator wants to ensure that a custom service (myapp.service) starts only after the network is available and the PostgreSQL database service is running. Which systemd unit file directive should be used?
⚠ Common exam trap
Test-takers frequently confuse ordering directives (`After=`, `Before=`) with dependency directives (`Requires=`, `Wants=`, `BindsTo=`), and assume that `Requires=` or `Wants=` automatically imply ordering, which they do not without an explicit `After=` or `Before=`.
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
✓
After=network.target postgresql.service
The `After=` directive in a systemd unit file specifies ordering constraints, ensuring that `myapp.service` starts only after `network.target` and `postgresql.service` have reached the 'started' state. This does not create a dependency that forces those units to start; it only orders the startup sequence, which is exactly what the administrator needs to guarantee the service starts after the network and PostgreSQL are available.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Requires=network.target postgresql.service
Why it's wrong here
Requires= creates a dependency but does not guarantee start order; After= is needed.
- ✗
Wants=network.target postgresql.service
Why it's wrong here
Wants= is a weaker dependency, but still no ordering.
- ✗
BindsTo=network.target postgresql.service
Why it's wrong here
BindsTo= binds the service lifecycle to the listed units, but does not specify ordering.
- ✓
After=network.target postgresql.service
Why this is correct
After= ensures myapp starts after the listed units are active, combined with Wants= or Requires= for dependency.
Go deeper
Related to this question
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 →
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.