easyMultiple ChoiceObjective-mapped
XK0-006 Practice Question: A junior administrator writes a bash script to…
A junior administrator writes a bash script to check disk usage and send an email alert. The script runs manually but does not execute from cron. Which of the following is the most likely cause?
⚠ Common exam trap
CompTIA often tests the misconception that cron failures are due to file permissions or missing shebangs, when the real issue is the restricted cron environment—specifically the lack of an absolute path or a missing PATH variable.
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
✓
Absolute path not specified in crontab
When a script runs manually from the command line but fails from cron, the most common cause is that cron does not inherit the user's PATH environment. Without an absolute path to the script in the crontab entry, cron cannot locate the script. Option D directly addresses this: specifying the full path (e.g., /home/user/script.sh) ensures cron can find and execute it.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Script not marked executable
Why it's wrong here
If not executable, the script would fail when run manually with ./script.sh unless invoked with bash script.sh.
- ✗
Incorrect file permissions on cron job
Why it's wrong here
Cron job file permissions do not affect execution of the script; the cron daemon reads the crontab as the user.
- ✗
Missing shebang line
Why it's wrong here
A missing shebang would cause failure in both manual and cron runs, not just cron.
- ✓
Absolute path not specified in crontab
Why this is correct
Cron runs with a minimal PATH; without a full path to the script, the job will not find it.
Go deeper
Related to this question
Learn chapter
User and Group Administration
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.
Key term
crontab
Crontab is a time-based job scheduler in Unix-like operating systems that allows users to automate the execution of scripts or commands at specified intervals.
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.