Interview Prep/Linux/Boot, time, cron and kernel

A daily cron job worked for months but now fails with `/bin/sh: 1: /opt/tools/report.sh: not found`, although the file exists.

AdvancedTroubleshootingBoot, time, cron and kernel
Answer

Likely causes → The script's shebang points to an interpreter that's gone (e.g. #!/usr/bin/python after Python 2 removal), or it's a binary for another architecture or missing its dynamic loader. The "not found" refers to the interpreter, not the script.

Diagnose →

head -1 /opt/tools/report.sh
file /opt/tools/report.sh
ls -l "$(head -1 /opt/tools/report.sh | sed 's/^#!//; s/ .*//')"

Fix → Update the shebang (#!/usr/bin/env python3), install the interpreter, or rebuild the binary for this architecture.

Prevent → Use env-based shebangs and test scripts after OS upgrades.

All Linux questions Roadmap: Linux

More on Boot, time, cron and kernel