Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am unable to configure a cron job to run by placing it in /etc/cron.hourly folder.


# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

The file under cron.hourly is :

lrwxrwxrwx 1 root root   40 2010-07-26 14:52 check -> /usr/local/xxxx/check-interface.bash

Permissions on the file :

-rwxr-xr-x 1 root root 1.6K 2010-09-13 11:22 /usr/local/xxxx/check-interface.bash

There seems to be no errors reported in the var/log/cron logfile. No mention of the script is done. :(

share|improve this question
Are you sure crond is running? – jamespo Mar 28 '11 at 15:33
yep, i restart the daemon after the changes manually. – Ricko M Mar 28 '11 at 15:50
chmod +x /usr/local/xxxx – forcefsck Mar 28 '11 at 16:51
What version of Cron do you have (it's ok if you say what distribution you have)? Some versions have rules for naming files in /etc/cron.*. Is check the actual name of the symlink? Does the script run correctly if you run it manually? Are you sure it's not running and just having no visible effect? – Gilles Mar 28 '11 at 18:48
Is this a debian system, per chance? – Glen Solsberry Mar 29 '11 at 15:43
up vote 3 down vote accepted

In order to isolate the problem, move /usr/local/xxxx/check-interface.bash to /etc/cron.hourly/check , and then see if it runs.

If the script does run, then the problem is caused by an ownership/permissions or related issue which is preventing cron from executing scripts at /usr/local/xxxx/*.

If the script does not run, then the problem is most likely with your script itself.

As another sanity check, replace the contents of /usr/local/xxxx/check-interface.bash with something dead simple, like:

date > /tmp/check-interfaces.log 2>&1

And then see if /tmp/check-interfaces.log is actually being populated by your cronjob. If it does work, then the problem must be with your original script.

share|improve this answer
On several distros, run-parts explicitly skips files that have a period in them as they may have been generated by a package update. Maybe that's what he's running up against. – Shadur Mar 29 '11 at 11:02
Care to elaborate on that please ? I am not sure what you mean by having a period in it. Thanks! – Ricko M Mar 31 '11 at 9:22

I just want to confirm that as Shadur has mentioned earlier, the issue lies in the fact that by default the "run-parts" application used by cron will run only commands that contain only ASCII letters, _, and -. From the official man page:

   If  neither the --lsbsysinit option nor the --regex option is given then the names must consist entirely of ASCII upper- and lower-case letters, ASCII digits,
   ASCII underscores, and ASCII minus-hyphens.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.