• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

cron job not working : troubleshooting steps

November 5, 2014 by Sharad Chhetri

In this post,I am sharing the troubleshooting steps for cron job problem. You may have seen many times, the cron job stopped working suddenly or not working on first instance. As a Linux System Engineer,I also faced this problem many times.The reasons are many and we are sharing few them which generally occurs.

What is Cron

Cron is a utility in Unix Like Operating System,which is a time based job scheduler. To maintain the Cron, we use the cron table called crontab .
Here,the job means the script/command . When we define any job(script/command/process) in crontab to be excecuted ,that job is called cron job.

Cron is different from at scheduler. The one basic different is at can be used for only one time. Whereas in Cron, the job is executed every time as per the defined date,day,time and month.

Crontab Syntax :

m h dom mon dow command

Here in above syntax,
m = Minute
h = Hour
dom = Date of month
dow = Day of week (eg. Sunday,Monday,Tuesday etc.)
Command = The command or script to be run from cronjob.

Recommendation : Read edit the crontab without using crontab -e. It will give some insight on how crontab can be edited from file.

Troubleshooting Steps for cronjob

We are listing some common practices for troubleshooting cronjobs. We expect you have some knowledge about setting cronjob.

1. Command / Script not executed from cronjob

This is the common problem generally seen by many Linux system admins. Here are the possible reason

(a) Command not found : Command is not available in system which system admin want to execute. Check the command if it is available in system. If not, then install the command/utility on your system.

(b)In this same section, we will talk about script do not run from cronjob. The possible reason for script not running are –
* Execute permission is not given to script for the user.
* Appropriate Ownership and group is not given to script.
* Command used in script is not available in system.
* Typo error in script.

2. Password expires

It might be possible the password is expire for user who will run the cronjob. For troubleshooting, check password expiration for root and other users.
To check password expiration status, use the below given syntax. Replace username with your system user.

chage -l username

3. User account is inactive

The inactive user account is another reason for cronjob suddenly stop working or do not work.
You can use similar command as we have used for checking password expiration.

chage -l username

4. Disk usage or inode is 100% full

When disk is full with no free space, it will not allow script or command to be run.
It might be possible when inode is 100% for partition, script or command will not run from cronjob.

To check disk space and inode usage togetherly, use the following command.

df -thi

There can also be possible reason which vary from network to network and type of servers.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Run cron job alternate week day
  2. print working directory ( pwd , PWD , OLDPWD ) in Linux / Unix
  3. Easy steps to install latest google chrome in Linux Mint 15
  4. A few steps to install Fluxbox in Ubuntu
  5. 3 Steps to install skype 4.3 on Ubuntu 14.04 / 12.04
  6. Change default editor of crontab in Ubuntu

Filed Under: Linux Tagged With: cron, crontab

Reader Interactions

Comments

  1. Deepak Pandiyan says

    November 17, 2016 at 11:26 am

    When i tried to edit the cronjob,getting this error
    # crontab -e
    crontab: installing new crontab
    crontab: error renaming /var/spool/cron/#tmp.XXXXkLwcMZ to /var/spool/cron/root
    rename: Is a directory
    crontab: edits left in /tmp/crontab.1zNzz2

    ##cron entries which i tried to enter
    00 22 * * * /apps/LDAP_Daily_Backup/Script/Backup_LDAP.sh

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Show visitor ip address php code

error command ‘gcc’ failed with exit status 1 in Ubuntu

Edit the crontab without using crontab -e

How to configure ethernet in CentOS 6 after installing in Virtual Box

How to download package using apt-get command in ubuntu

convert space into new line using sed command

How to zip the directory in linux with command line

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy