How to fix cron jobs that don't run?

Better Stack Team
Updated on May 26, 2023

If your Cron Jobs are not running, there could be several reasons why they are failing. Here are some common issues and solutions that you can try:

1. Check if the cron daemon is running:

Make sure that the cron daemon is running. You can check if it's running by running the command systemctl status cron. If it's not running, you can start it by running the command systemctl start cron.

2. Check the cron log file:

The cron log file can be used to diagnose any issues. Check the log file to see if there are any error messages or if the cron job is being executed. The log file can be found at /var/log/syslog.

3. Check the user permissions:

Make sure that the user running the cron job has permission to execute the command. If you're running the cron job as a different user, make sure that the user has the necessary permissions to execute the command.

4. Check the file path:

Make sure that the path to the command or script is correct. Cron jobs may have a different environment than the user's shell, so make sure that the full path to the command or script is specified in the cron job.

5. Check the syntax:

Check the syntax of the cron job entry in the crontab file. Make sure that there are no syntax errors in the command or the timing fields.

6. Check the environment variables:

If you're using environment variables in your cron job, make sure that they are set correctly. Cron jobs run in a limited environment, so it's important to set the necessary environment variables in the crontab file.

7. Restart the cron daemon:

If none of the above solutions work, try restarting the cron daemon by running the command systemctl restart cron.

By following these steps, you should be able to diagnose and fix most issues with cron jobs not running.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →

Reliability is the
ultimate feature

Delightful observability tools that turn your logs & monitoring into a secret weapon for shipping better software faster.

Explore Better Stack