📖 ~1 min read
Table of contents
Symptom & Impact
Scheduled tasks run at unexpected times or fail silently, disrupting operations.
Environment & Reproduction
Often triggered by migration from interactive shell scripts to cron without explicit env.
crontab -l
systemctl status cron
Root Cause Analysis
Cron uses minimal environment and system timezone may differ from expected schedule context.
Quick Triage
Check timezone, cron daemon health, and recent cron logs.
timedatectl
systemctl status cron
journalctl -u cron -n 80 --no-pager
Step-by-Step Diagnosis
Validate job command paths and compare execution environment with shell profile.
crontab -l
which bash python3
cat /etc/crontab
printenv | sort

Solution – Primary Fix
Set explicit TZ and PATH in crontab, use absolute command paths, and log output.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
(crontab -l; echo 'TZ=UTC'; echo 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'; echo '*/5 * * * * /usr/bin/bash /opt/jobs/task.sh >> /var/log/task.log 2>&1') | crontab -
sudo systemctl restart cron

Solution – Alternative Approaches
Use systemd timers for richer logging, dependency control, and timezone handling.
systemctl list-timers --all
Verification & Acceptance Criteria
Jobs execute on expected schedule and produce expected output artifacts/logs.
grep CRON /var/log/syslog | tail -n 20
tail -n 20 /var/log/task.log
Rollback Plan
Restore previous crontab backup and restart cron.
crontab /tmp/crontab.backup
sudo systemctl restart cron
Prevention & Hardening
Version-control scheduled tasks and validate runtime env in preflight scripts.
Related Errors & Cross-Refs
Related to locale differences and missing execute permissions on scripts.
Related tutorial: View the step-by-step tutorial for Ubuntu 26.04 LTS.
View all Ubuntu 26.04 LTS tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Ubuntu cron and systemd timer operational documentation.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.