hardMultiple Choice
XK0-006 Practice Question: A sysadmin is tasked with creating a script that…
A sysadmin is tasked with creating a script that will run only on weekdays at 9:00 AM using cron. The script should not run on holidays. Which approach best achieves this requirement?
⚠ Common exam trap
CompTIA often tests the misconception that cron can directly handle holidays, when in fact cron has no concept of holidays and requires external logic (like a script check) to skip them.
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
✓
Use cron to run at 9:00 on weekdays, and include a test in the script that checks a holiday list
Cron can schedule the script to run at 9:00 AM on weekdays using the day-of-week field (e.g., `0 9 * * 1-5`), and the script itself can check a holiday list (e.g., a file or API) to exit early on holidays. This approach cleanly separates scheduling from holiday logic, avoiding cron's lack of built-in holiday awareness.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use systemd timers with a calendar specification that excludes holidays
Why it's wrong here
systemd calendar specifications support weekday ranges but no holiday exclusion syntax, so the timer fires on holidays unless external logic intervenes. It suits recurring jobs needing monotonic-clock accuracy and dependency ordering, not calendar-aware holiday skipping.
- ✓
Use cron to run at 9:00 on weekdays, and include a test in the script that checks a holiday list
Why this is correct
Cron cannot natively exclude holidays, so scheduling weekdays at 09:00 and testing a holiday list inside the script is the only reliable approach. The script exits early on holidays, meeting both the weekday and holiday constraints.
- ✗
Use cron to run at 9:00 every day, and include conditional logic to abort on weekends
Why it's wrong here
Running daily with weekend-abort logic still fires the job on holidays, which the requirement explicitly excludes. It is tempting because cron's day-of-week field genuinely cannot express "weekdays excluding holidays", so wrapping the schedule in a script feels like the natural workaround — but that logic must also consult a holiday calendar, not just the weekend test.
- ✗
Use `at` to schedule the job individually each weekday morning
Why it's wrong here
`at` schedules one-off jobs and has no holiday awareness, so each weekday invocation must be created manually and still fires on holidays. It suits single deferred commands, such as a one-time reboot at a specific time, not recurring weekday-only execution.
Go deeper
Related to this question
About these practice questions
This XK0-006 question is part of Courseiva's 781-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 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.