← Problem Library
Linux L3 LINUX-010 · 15 min

A missing environment variable that fails under cron but works when run manually

A problem for checking which defaults are dropped when the same script runs in a different execution environment.

LinuxFoundation OpsLevel 3Free15 min
Scenario

A scenario that narrows down the root cause, centered on checking the difference between the non-interactive execution environment and the manual execution environment, in the situation of a missing environment variable that fails under cron but works when run manually.

What to check first
  • Identify the primary failure signal in the Execution Context scenario.
  • Separate visible symptoms from the underlying technical dependency.
  • Describe the safest recovery path and the follow-up prevention work.
Checking checklist
  1. Summarize the current impact and the last known change.
  2. Collect direct evidence from logs, runtime state, and configuration before changing anything.
  3. Separate immediate recovery from permanent prevention work.
Recovery and prevention

Choose the smallest safe recovery action first, then record the prevention work that reduces repeat incidents.

Questions worth viewing together
Why do cron and manual runs diverge so often?

Cron provides a much smaller execution context, so PATH, shell behavior, and environment variables can differ dramatically.