Skip to content
FixingBook
Verifiedintermediateest. 20 minutes

Fix Cron Jobs Not Running in Linux

Identify common reasons cron jobs fail to execute, including environment variables, paths, and permissions.

Confirmed working on: All Linux Distributions

Before you begin

Match the environmentUse this guide only for All Linux Distributions or a clearly compatible setup.
Protect recoveryBack up important data and save encryption or account recovery keys before changing system state.
Know when to stopMake one change at a time and stop if the result differs from what the guide describes.

Problem overview

You scheduled a task in your crontab, but it fails to execute at the designated time, or it runs but fails silently without producing the expected results.

Common causes

  • The cron daemon is not running on your system.
  • The script uses commands that are not in cron’s limited PATH.
  • The script file lacks executable permissions.

Solution 1: Use absolute paths in the crontab

Cron does not know where commands like python3, node, or even basic utilities are located unless you specify the exact path.

  1. Open a terminal.
  2. Find the absolute path of the command you are trying to run:
    which python3
    (This might output /usr/bin/python3)
  3. Edit your crontab:
    crontab -e
  4. Update the job to use absolute paths for both the executable and your script:
    * * * * * /usr/bin/python3 /home/user/scripts/backup.py
  5. Save and exit the editor.
Expert Tip

You can also define the PATH variable directly at the top of your crontab file to avoid writing full paths for every command.

Solution 2: Make the script executable

If you are running a bash script, it must have execute permissions.

  1. Open your terminal.
  2. Grant execute permissions to your script:
    chmod +x /home/user/scripts/backup.sh
  3. Test the script manually to ensure it runs correctly before relying on cron.

Solution 3: Capture cron output for debugging

By default, cron emails errors to the system administrator account. If you do not have a local mail server configured, you lose these error messages.

  1. Edit your crontab:
    crontab -e
  2. Redirect both standard output and error output to a log file:
    0 2 * * * /home/user/scripts/backup.sh >> /tmp/cron_backup.log 2>&1
  3. Wait for the job to run, then inspect the log file:
    cat /tmp/cron_backup.log

Solution 4: Verify the cron daemon status

If no cron jobs are running at all, the service might be stopped.

  1. Check the status of the cron daemon:
    sudo systemctl status cron
    (On some distributions like Fedora or Arch, the service is named crond.)
  2. If it is stopped, start the service:
    sudo systemctl start cron
  3. Enable it to run on boot:
    sudo systemctl enable cron

Confirm the result

  1. Repeat the exact action that originally triggered the problem.
  2. Confirm the original error or symptom is gone and no new warning has appeared.
  3. If the guide changed a driver, service, package, or system setting, restart once and test again.
  4. If the result is worse or unexpected, stop. Reverse only the last change using its documented restore option; if none is documented, use your backup or qualified support.

Questions about this fix

Why does my script work in the terminal but not in cron?

Cron runs in a minimal environment. It does not load your shell profile, so it often lacks the PATH variables needed to find your commands.

How do I see if a cron job actually ran?

You can check the system logs in /var/log/syslog or /var/log/cron, or you can redirect the output of the job to a specific file.

Did this fix work for you?

Weighted Consensus Protocol

Consensus0%
Required100% (Weight 3)
Contributors0
Verified By YouNo
Your Weight--

Did this solution resolve your issue?

Confirming if this works strengthens verification statistics on the registry.

Sign In to VerifySign in required to verify

FixingTeam10,000 rep

Official Project Maintainers

The core engineering and moderation team behind FixingBook. We curate, verify, and maintain the standards of the troubleshooting ledger.

Spotted something outdated? Suggest an edit. Maintainers review submissions within 48 hours.
Share:XReddit

Discussion (0)

No comments yet. Share your experience or verify if this fixed your issue!

Join the Discussion