This is a Red Hat Enterprise Linux 5 system (RHEL). We manage this system using CFengine.

We have several cronjobs which are running twice as often as usual. I checked the cronjobs under /etc/cron.d/ and this directory contains the actual script called host-backup, and also contains a cfengine backup file called host-backup.cfsaved, as so:


Does this operating system execute all files at /etc/cron.d/*, or does it only execute files which match a certain pattern. Can I configure this, and where is this defined?

I cannot find this answer in the RHEL or CentOS documentation.


(If you're paying for Red Hat support, you should ask them this kind of questions. This is exactly what you're paying for!)

From the RHEL5 crontab(5) man page:

If it exists, the /etc/cron.d/ directory is parsed like the cron spool directory, except that the files in it are not user-specific and are therefore read with /etc/crontab syntax (the user is specified explicitly in the 6th column).

(Is there a simpler way of reading RHEL man pages without having access to it? At least this way I could see that this paragraph is part of the Red Hat patch, so it's not a standard Vixie Cron 4.1 feature.)

Looking at the source, I see that the following files are skipped: .*, #*, *~. *.rpmnew, *.rpmorig, *.rpmsave. So yes, your *.cfsaved files are read in addition to the originals.

  • Hi Giles, thanks I found that exact same syntax from vixie-cron-4.1-77.el5_4.1.src.rpm. Ironically, this text is NOT included within any of the man pages for cron and is not included with any text file on the system. I'm not sure why that is, but it's a topic for another discussion. – Stefan Lasiewski Dec 13 '10 at 20:12
  • And I posted a follow up question at unix.stackexchange.com/questions/4815 – Stefan Lasiewski Dec 13 '10 at 22:09
  • @Giles: You win. The RedHat source should contain the definitive answer. In this case, (the source seems to differ from the installed files)[unix.stackexchange.com/questions/4815], but that is a different topic. – Stefan Lasiewski Jan 4 '11 at 23:12

I think the reason you've had difficulty tracking down the answer is that it's not a Red Hat-specific question. The problem you're seeing is part of the standard functionality of cron - each file in the directory you identify is automatically treated as a separate job.

So, the short answer to your question is "yes, all files are executed". This is not something I think that can be configured.

  • 2
    There are different implementations of cron. Debian and Ubuntu ship with Vixie Cron (3.0), and the handling of cron.d is described in its man page. RHEL ships with ISC cron 4.1 (a fork of the same project), and the man page (at least on CentOS) doesn't mention cron.d. – Gilles 'SO- stop being evil' Dec 9 '10 at 18:40
  • 1
    @Gilles: Thanks for the pointers. I'm using Fedora, which has Cronie installed (also a fork of Vixie/ISC Cron). The man page does mention /etc/cron.d as being one one of the search paths. I apologize if there wasn't enough detail in my answer - I'm reasonably sure that this should apply to Red Hat as well. Please let me know if that's not the case – mlschechter Dec 11 '10 at 3:14
  • 1
    After looking into it, this is precisely a Red Hat-specific question (see my answer). It's so Red Hat-specific that even CentOS is different, and Fedora is probably different as well (but I haven't checked). – Gilles 'SO- stop being evil' Dec 11 '10 at 12:13
  • 1
    @Gilles - sorry for the delay in responding. As of Red Hat EL 5, Red Hat uses vixie-cron. RHEL 6 uses cronie. After reviewing the RHEL 5 documentation, I think it confirms my original (if incorrectly sourced) conclusion. Again, thanks for all the help on digging for this. – mlschechter Dec 14 '10 at 3:32

Here is the answer from RedHat support:

Please be informed that all files under cron.d directory are examined and executed, it's basically an extension of /etc/crontab file (ie; same effect if you add the entries to /etc/crontab file)

So, to answer my question "Does this operating system execute all files at /etc/cron.d/*, or does it only execute files which match a certain pattern. Can I configure this, and where is this defined?"

All files under /etc/cron.d/* are executed (Although it seems that certain file extensions such as .rpmsave, *~, etc are ignored, according to documentation in the source files). It is not possible to configure this via a configuration file. Configuring this is probably possible if the source is recompiled. This behavior is mentioned in the documentation contained with the source, but doesn't appear in any manual or man page that I can find.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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