easyMultiple Choice
XK0-006 Practice Question: A Linux system administrator for a small company
You are a Linux system administrator for a small company. You have written a BASH script that checks disk usage and sends an email alert if any partition exceeds 90% usage. The script works when run manually but does not produce alerts when run via cron. Which of the following is the most likely cause?
⚠ Common exam trap
CompTIA often tests the concept that cron jobs have a restricted environment, particularly PATH, and candidates mistakenly focus on script permissions or relative paths instead of the missing command path in cron's minimal shell.
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 cron job's PATH variable does not include the directory where the mail command is located
When a script runs manually, it inherits the user's interactive shell environment, including the PATH variable that typically includes directories like /usr/bin and /usr/local/bin where the mail command resides. However, cron jobs execute in a minimal environment with a very restricted PATH (often just /usr/bin:/bin). If the mail command is located in a directory not in cron's default PATH, such as /usr/sbin or /opt/bin, the script will fail silently when attempting to send the email, even though the disk usage check itself succeeds. This is the most common cause of scripts working manually but failing under cron.
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 job's PATH variable does not include the directory where the mail command is located
Why this is correct
Cron runs with a minimal environment, so its PATH typically omits /usr/bin or /bin where mail resides. The script's manual success relies on your interactive PATH. Specifying the absolute path to mail, or exporting PATH within the script, resolves the missing-command failure.
- ✗
The script has incorrect file permissions
Why it's wrong here
Permissions cannot be the cause: the script runs successfully from the shell, proving execute and read bits are already sufficient. It tempts because permission errors are a common cron failure, and would be correct if cron logged a permission-denied error instead of running the script.
- ✗
The cron scheduler is disabled
Why it's wrong here
Cron itself clearly runs, since the script executes but produces no alert; a disabled daemon would suppress all scheduled jobs, not just this one. It tempts because a stopped crond is a genuine cause of silent cron failures, and would be correct if no jobs ran at all.
- ✗
The script uses relative paths to check partitions
Why it's wrong here
Relative paths would break manual execution too, since the shell's working directory differs from cron's; the script works by hand, so paths resolve. It tempts because cron's minimal environment genuinely breaks relative paths, and would be correct if the script failed in both contexts.
Go deeper
Related to this question
Learn chapter
Advanced Shell Scripting and Automation
Key term
Linux
Linux is an open-source operating system that manages computer hardware and software, widely used in servers, desktops, and embedded systems.
Key term
Bash script
A Bash script is a text file containing a sequence of commands for the Unix shell Bash, allowing users to automate repetitive tasks and streamline system administration on Linux and macOS.
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.