LFCS Service Configuration Practice Question
A Linux administrator is configuring a custom systemd service called backup.service. The service should run a backup script only when the server is connected to AC power and not running on battery. Which condition directive should be added to the [Unit] section of backup.service?
⚠ Common exam trap
A common mix-up: candidates confuse ConditionACPower with a generic file existence check, leading to the use of ConditionPathExists on a power supply path.
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
✓
ConditionACPower=true
ConditionACPower=true is the correct directive because it directly checks whether the system is running on AC power. When the system is on battery, the condition fails, and systemd skips the unit. This prevents the backup from running and draining battery. Other conditions check file existence, kernel command line, or capabilities, none of which reliably indicate AC power status.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
ConditionACPower=true
Why this is correct
ConditionACPower=true ensures the unit runs only when the system is on AC power. In this scenario, the administrator wants the backup to execute only when the server is not on battery, so this directive precisely matches the requirement. It is a condition, not a dependency, so if the condition is not met, the unit is skipped without failure.
- ✗
ConditionKernelCommandLine=ac
Why it's wrong here
This condition tests for the presence of 'ac' in the kernel command line, which is unrelated to AC power status. Kernel command line parameters are set at boot and do not change when the power source changes, so this would not prevent the backup from running on battery. It is entirely the wrong condition for power state detection.
- ✗
ConditionCapability=CAP_SYS_ADMIN
Why it's wrong here
This condition checks whether the service has the CAP_SYS_ADMIN capability, which is about privileges, not power source. It would not restrict the backup based on AC power. Using this would allow the backup to run regardless of battery status, failing the scenario's goal. It is a privilege condition, not a hardware state condition.
- ✗
ConditionPathExists=/sys/class/power_supply/AC/online
Why it's wrong here
This directive checks only for the existence of a file, not whether the system is actually on AC power. Even if the path exists, the system could be running on battery, so the condition would incorrectly allow the backup to run. It is a filesystem check, not a power state check, and thus does not fulfill the scenario's requirement.
Go deeper
Related to this question
About these practice questions
This LFCS question is part of Courseiva's 406-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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Linux Foundation exam blueprint
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.