mediumMultiple Choice
XK0-006 Practice Question: A Linux engineer is troubleshooting a cron job…
A Linux engineer is troubleshooting a cron job that does not execute as expected. The crontab entry reads: '*/5 * * * * /usr/local/bin/backup.sh'. The script runs manually when executed as root. Which of the following is the most likely cause?
⚠ Common exam trap
CompTIA often tests the misconception that a script failing in cron is due to permissions or the cron daemon status, when the real issue is the stripped-down environment that lacks variables the script depends on.
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
✓
The script requires environment variables that are not set in cron's shell.
D is correct because cron jobs run in a minimal shell environment (typically /bin/sh) with a very limited set of environment variables. The script /usr/local/bin/backup.sh may rely on variables like PATH, HOME, or custom variables that are not set in cron's shell, causing it to fail even though it runs fine manually as root. This is a classic cron issue where the interactive shell's environment differs from cron's non-interactive environment.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The cron daemon is not running.
Why it's wrong here
If the cron daemon were stopped, no scheduled job on the host would run at all, yet the stem presents a single failing entry rather than system-wide cron silence. It is tempting because a dead crond is a classic cause of jobs never firing, and would be correct if the engineer confirmed no crontab entries anywhere were executing.
- ✗
The script file does not have execute permissions.
Why it's wrong here
The script executes successfully when run manually as root, which proves the execute bit is already set; cron would otherwise fail identically from the shell. It is tempting because missing execute permissions is a frequent cause of silent cron failures, and would be the answer if manual invocation also returned permission denied.
- ✗
The system clock is incorrect.
Why it's wrong here
An incorrect system clock shifts when cron fires but does not prevent execution entirely; the job would still run, merely at unexpected times. It is tempting because clock drift is a known cause of jobs triggering at wrong intervals, and would be the answer if the stem described mistimed runs rather than a job that never executes.
- ✓
The script requires environment variables that are not set in cron's shell.
Why this is correct
Cron runs jobs with a minimal environment, so variables defined in root's interactive shell profile are absent. The script succeeds manually because those variables exist there, but fails under cron — matching the stem's symptom of a job that only works when run by hand.
Go deeper
Related to this question
Learn chapter
Installing Linux and Package Management
Key term
Shell
A shell is a computer program that provides a user interface to access an operating system's services, typically by accepting text commands.
Key term
cron
Cron is a time-based job scheduler in Unix-like operating systems that automatically runs commands or scripts at specified dates and times.
About these practice questions
One of 781 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.