Affected versions: Ubuntu 24.04 LTS

📖 ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

Scheduled maintenance tasks do not execute, causing stale data and missed backups.

Environment & Reproduction

Often due to environment assumptions not present in cron.

systemctl status cron
crontab -l
sudo grep CRON /var/log/syslog | tail -n 40

Root Cause Analysis

Incorrect cron syntax, missing executable bit, or limited PATH in non-interactive shell.

Quick Triage

Validate cron daemon activity and job definitions.

systemctl is-active cron
crontab -l
sudo ls -l /etc/cron.*

Step-by-Step Diagnosis

Test job command with minimal environment.

env -i /bin/bash -lc '/path/to/script.sh'
namei -l /path/to/script.sh
file /path/to/script.sh
Illustrative mockup for ubuntu-24-04-lts — terminal_or_shell
Inspecting cron service and user crontabs — Illustrative mockup — Progressive Robot

Solution – Primary Fix

Use absolute paths, executable scripts, and explicit shell settings.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

chmod +x /path/to/script.sh
( crontab -l; echo 'SHELL=/bin/bash'; echo 'PATH=/usr/sbin:/usr/bin:/sbin:/bin'; echo '*/15 * * * * /path/to/script.sh >> /var/log/script.log 2>&1' ) | crontab -
Illustrative mockup for ubuntu-24-04-lts — log_or_config
Fixing PATH and cron script permissions — Illustrative mockup — Progressive Robot

Solution – Alternative Approaches

Migrate critical jobs to systemd timers for better observability.

systemctl list-timers --all
systemctl status cron

Verification & Acceptance Criteria

Cron executes on schedule and writes expected logs.

sudo grep CRON /var/log/syslog | tail -n 50
tail -n 50 /var/log/script.log

Rollback Plan

Restore previous crontab from backup if schedule changes regress behavior.

crontab -l > /var/tmp/crontab.bak.$(date +%s)
# restore with crontab 

Prevention & Hardening

Version-control job definitions and alert on missed executions.

Can be confused with time zone drift or disabled cron service.

Related tutorial: View the step-by-step tutorial for Ubuntu 24.04 LTS.

View all Ubuntu 24.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 best practices.

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.