Skip to content

Cron job not running: how to get it started

Medium 20 min Updated:

Quick answer

A cron job most often fails to run due to incorrect syntax in the crontab, missing execute permission, wrong path to the script, or because the cron service is not started. Check the logs, test the script manually, and use absolute paths.

How to recognize the problem

  • The job does not start at the scheduled time
  • No expected output or file
  • Cron log is empty or shows errors
  • The script works manually but not from cron
  • Email error notifications are not arriving

Most common causes

Cron service is not running

If the cron daemon is not active, no jobs will execute. Check the service status and start it if needed.

Incorrect syntax in the crontab

An error in the time fields or a missing trailing newline can prevent execution. Check the format and use `crontab -l` to see active jobs.

Missing execute permission

The script must have execute permission (`chmod +x`). Also, check that the owner is the user running cron.

Wrong path or environment

Cron uses a limited environment, so relative paths and variables can be a problem. Use absolute paths and explicitly define variables.

Permission or ownership issues

Files accessed by the script must be readable by the cron user. Check permissions and ownership of files and directories.

Step-by-step fix

  1. 1

    Check if the cron service is running

    Run systemctl status cron (or systemctl status crond on some distributions). If the service is not active, start it with sudo systemctl start cron and enable automatic startup with sudo systemctl enable cron.

  2. 2

    Review active cron jobs

    Run crontab -l to see jobs for the current user. For system jobs, check the /etc/crontab file and the /etc/cron.d/ directory. Make sure there are no syntax errors.

  3. 3

    Test the script manually

    Run the script from the terminal with the same user that runs cron. If it does not work manually, the problem is in the script, not in cron. Fix errors and test again.

  4. 4

    Use absolute paths

    In the crontab, specify the full path to the script and interpreter, e.g. /usr/bin/python3 /home/user/script.py. The same applies to files accessed by the script.

  5. 5

    Set environment variables

    At the top of the crontab, add PATH=/usr/bin:/bin and other necessary variables. You can also define them inside the script. Avoid relying on variables from an interactive session.

  6. 6

    Check permissions and ownership

    Make sure the script has execute permission (chmod +x script.sh) and that the user running cron has the right to read and execute it. Also check permissions on directories and files used by the script.

  7. 7

    Review cron logs

    On systems with systemd-journald, use journalctl -u cron or journalctl -u crond. On other systems, check /var/log/syslog or /var/log/cron. Look for errors related to your job.

  8. 8

    Temporarily redirect output to a file

    Add >> /tmp/cron.log 2>&1 to the end of the line in the crontab to capture standard output and errors. Then review the file after the job runs.

  9. 9

    Check if the time is correct

    Make sure the system time is correct (date). If the time zone is wrong, cron will run at the wrong time. Set the time zone and time synchronization.

If nothing helps

If you have checked everything listed and the job still does not run, try running cron in debug mode. For Vixie cron, briefly stop the service and start it manually with sudo cron -f -x proc (or the appropriate option for your cron); after testing, restart the service. This will show detailed information about job processing. Also, check if there are restrictions via /etc/cron.allow and /etc/cron.deny files that may prevent a user from using cron. Finally, consider an alternative such as systemd timer, which offers better logging and management.

How to prevent it

  • Regularly check cron logs
  • Use absolute paths and explicit variables
  • Test scripts before adding them to cron
  • Limit permissions and monitor file ownership

When to call a professional

If you cannot find the cause or do not have access to logs and system files, contact IT support. They can isolate the problem faster and prevent work disruptions.

IT infrastructure maintenance · Servers, networks, backup, security and helpdesk

FAQ

Why is my cron job not running even though the syntax is correct?

The most common reason is missing execute permission for the script or a wrong path to the interpreter. Check if the script works when run manually and if all paths are absolute.

How can I see errors reported by cron?

You can temporarily redirect output to a file by adding `>> /tmp/cron.log 2>&1` to the crontab. Also, check system logs such as `/var/log/syslog` or `journalctl -u cron`.

Is cron the same as anacron?

No. Cron is intended for precise scheduling but will not run missed jobs if the computer was off. Anacron is designed to run missed jobs but does not guarantee exact timing.

Share
Didn't find a fix?The AI IT assistant is available 24/7. Describe the problem or send a screenshot of the error and get instructions for your case.Ask the AI IT assistant