Courseiva
hardMultiple ChoiceObjective-mapped

XK0-006 Practice Question: Refer to the exhibit

Exhibit

Feb 12 02:00:01 hostname CRON[1234]: (root) CMD (/usr/local/bin/backup.sh) -> /usr/local/bin/backup.sh: line 3: syntax error near unexpected token `fi'

Refer to the exhibit. The administrator receives an email that a cron job failed. What is the most likely cause?

⚠ Common exam trap

CompTIA often tests the distinction between script execution failures due to syntax errors versus permission or environment issues, and the trap here is that candidates may incorrectly attribute the failure to a missing shebang line or non-executable script, overlooking the specific syntax error message shown in the exhibit.

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 has an unmatched if statement.

The cron job failed because the script contains an unmatched if statement, which causes a syntax error when the shell interprets the script. Cron jobs execute scripts in a non-interactive shell, and any syntax error will cause the script to exit with a non-zero status, triggering the failure email. The unmatched if statement prevents the script from completing execution, leading to the reported failure.

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 script is not executable.

    Why it's wrong here

    Incorrect: The script executed (it ran to line 3) so it is executable.

  • The script is missing a shebang line.

    Why it's wrong here

    Incorrect: A missing shebang would prevent execution entirely, but the script ran to line 3.

  • The cron daemon is not running.

    Why it's wrong here

    Incorrect: The cron daemon ran the job, as shown by the log entry.

  • The script has an unmatched if statement.

    Why this is correct

    Correct: The error 'syntax error near unexpected token `fi'' suggests an if statement without a matching fi.

About these practice questions

This XK0-006 question is part of Courseiva's 979-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 →

How Courseiva writes practice questions · Editorial policy

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.