Mentioned in a comment in this post How are files under /etc/cron.d used?:

People might miss, that "the file names must conform to the filename requirements of run-parts" (see Debian's man cron). So filenames in /etc/cron.d/ which match the shell glob [!A-Za-z0-9_-] are ignored! Hence things like *.dpkg-dist or vi-backups *~ do no harm, but if you accidentally create /etc/cron.d/very_important.crontab, this will get ignored due to the . in it!

Is there any restriction in the cron.daily , cron.hourly, cron.monthly etc. folders by the above filenames with the ‘.’ symbol in the file names above? If not, then why? Why is the naming restriction only in /etc/cron.d/?

1 Answer 1


As explained in man 8 cron on Debian (the source of the quote):

Support for /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly is provided in Debian through the default setting of the /etc/crontab file (see the system-wide example in crontab(5)). The default system-wide crontab contains four tasks: run every hour, every day, every week and every month. Each of these tasks will execute run-parts providing each one of the directories as an argument. These tasks are disabled if anacron is installed (except for the hourly task) to prevent conflicts between both daemons.

As described above, the files under these directories have to pass some sanity checks including the following: be executable, be owned by root, not be writable by group or other and, if symlinks, point to files owned by root. Additionally, the file names must conform to the filename requirements of run-parts: they must be entirely made up of letters, digits and can only contain the special signs underscores ('_') and hyphens ('-'). Any file that does not conform to these requirements will not be executed by run-parts. For example, any file containing dots will be ignored. This is done to prevent cron from running any of the files that are left by the Debian package management system when handling files in /etc/cron.d/ as configuration files (i.e. files ending in .dpkg-dist, .dpkg-orig, .dpkg-old, and .dpkg-new).

(emphasis mine).

So yes, the same rules apply to file names under /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly as under /etc/cron.d.

All this is specific to Debian and derivatives, and doesn’t apply to your CentOS systems.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .