Question 330
The lab examiner asks for evidence after this assignment: A cron-invoked script prints `command not found` for a utility present in the interactive user's shell. What is the decisive verification step?
Explanation
Correct Answer
The script runs under a restricted environment and resolves required binaries. This check confirms the expected effect of: Use a controlled PATH declaration such as `PATH=/usr/sbin:/usr/bin:/sbin:/bin` or explicit command paths in the script. It distinguishes the intended result from the original failure mechanism: Noninteractive jobs do not necessarily inherit an interactive user's PATH and shell initialization.
Incorrect Answers
The output contains one result per unit and no unrequested service is started. That verifies a separate lab task: A service check is intended to poll five named systemd units, but the script uses only the first literal unit. It does not validate the implementation required here: Use a controlled PATH declaration such as `PATH=/usr/sbin:/usr/bin:/sbin:/bin` or explicit command paths in the script.
A fixture with no matches reports zero while actual unreadable-file errors remain flagged. That verifies a separate lab task: A reporting script pipes `grep` through `wc` and treats a zero-match grep exit as a catastrophic error even though zero results are valid. It does not validate the implementation required here: Use a controlled PATH declaration such as `PATH=/usr/sbin:/usr/bin:/sbin:/bin` or explicit command paths in the script.
The resulting filename contains the current date digits and `tar -tzf` lists expected members. That verifies a separate lab task: A script generates a timestamped training archive but literal quotes around the `date` substitution prevent expansion. It does not validate the implementation required here: Use a controlled PATH declaration such as `PATH=/usr/sbin:/usr/bin:/sbin:/bin` or explicit command paths in the script.