Why does a script work manually but fail in cron?
IntermediateConceptNetworking, SSH & Scheduling
Answer
Cron runs with a minimal environment: PATH=/usr/bin:/bin, SHELL=/bin/sh, no profile or bashrc, a different working directory, no TTY. Fixes: use absolute paths, set PATH= and SHELL=/bin/bash at the top of the crontab, cd explicitly, and capture output to a log. Also, % must be escaped as \% in crontab lines (common with date +%F). Check grep CRON /var/log/syslog or journalctl -u cron.
More on Networking, SSH & Scheduling
Which `ip` commands replace ifconfig, route and arp?BeginnerWhat does `ss` show, and which flags do you use?BeginnerExplain the TCP connection states you see in ss.AdvancedWhat happens, step by step, when you run `curl https://example.com`?AdvancedWhich curl flags are most useful for debugging?BeginnerHow do you use `dig` for DNS troubleshooting?Beginner