Do You Make These Cron Job Mistakes?

by Ramesh Natarajan on July 17, 2009

Question: Why my cron job does not get executed at the specified time ?

Answer: There may be lot of reasons why a cron job may not get executed. Let us review 5 important reasons of why a cron job does not run at the specified time and how to resolve those issues.

1. Misinterpretation of Time Field and Specifying Wrong Values.

Misinterpretation of the time field, and given values in the time field which does not mentions the expected/intended time.

For example, to execute a command at 8 PM, you should specify the time in 24 hour format. i.e 8 PM is 20 and not 8 as shown below.

0 8 * * * /home/ubuntu/full-backup
[Note: The is wrong for 8 p.m]
0 20 * * * /home/ubuntu/full-backup
[Note: This is correct for 8 p.m]

Read our tutorial Linux Crontab: 15 Awesome Cron Job Examples to get a deep understanding on crontab. One of our regular reader Binny has created a web interface which will generate cron entries when you select appropriate values for various crontab fields in the user interface.

2. Invalid Path to Shell Script or Commands in crontab

Make sure the full path to the shell script is specified in the crontab.

0 8 * * * tape-backup
[Note: Invalid. No full path specified]

0 8 * * * /home/debian-os/bin/tape-backup
[Note: Valid. This is correct with full path]

Note: If you don’t want to give full path in the crontab, make sure to add PATH variable in crontab (example #14)

3. No Execute Permission For the Shell Script in Cron

You might have given the correct command with correct path, but the command might not have execute permission. If you are using any Unix standard commands then it will be having the execute permission set by default.

But, if you are using some user defined commands (shell scripts), make sure to give execute permission to it as shown below.

*/15 * * * * /home/fedora-os/check-disk-space
[Note: Executes check-disk-space every 15 minutes]

# cd /home/fedora-os
# chmod u+x check-disk-space

4. %age in Cron Job Command or Shell Script

If a command has a % in it, your command will not get executed. Refer our previous Crontab %age Issue FAQ to understand how to fix this issue.

5. Disallowed to Execute Cron Job By Sysadmin

A system administrator can decide which user can run cron jobs and which users cannot. So to deny a user from executing a cron job, sysadmin might have placed your username in the /etc/cron.deny file.

If you have root privilege, check the /etc/cron.deny file to make sure your name is not listed in there. If it is listed, edit the file and remove your name. If you don’t have root privilege contact your sysadmin.


Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 3 comments… read them below or add one }

1 JAH July 17, 2009 at 10:02 am

You may also want to think about a followup issue on at,atq,atrm, batch.

Just a thought
Jay.

2 Ramesh Natarajan July 20, 2009 at 12:28 am

@Jah,

Thanks for the suggestion. I’ve added that in my list of future articles to write.

3 R&D September 6, 2012 at 7:38 am

THANK YOU

Leave a Comment

Previous post:

Next post: