configs with dots in file name not working in /etc/cron.d

Bug #706565 reported by Igor A Tarasov on 2011-01-23
This bug affects 6 people
Affects Status Importance Assigned to Milestone
cron (Ubuntu)

Bug Description

Binary package hint: cron

I configured cron jobs with config file:
and it not working.
I spend couple of hours to understand the problem.
Fix is to rename file withowt dots in the name:
is working.
Renaming back to job.cron or other name with the dot in the name cause cron to not read this file.
I just switched to Ubuntu Server from Fedora and it works before on those distributive.
I can't find any error messages in syslog event with -L9 command line in cron daemon.
I can't find any warning in man page or readme document about file names.

I think there are 2 possible ways to fix this:
1) put a WARNING about file names with dots (like "myjob.cron") in manpage;
2) make cron working with those files as other distro do (ex. Fedora)

Christian Kastner (ckk) wrote :

This is, in fact, documented. See:

Quoting (2nd paragraph):
Additionally, cron reads the files in /etc/cron.d [...] Files must conform to the same naming convention as used by run-parts(8): they must consist solely of upper- and lower-case letters, digits, underscores, and hyphens. [...]

Changed in cron (Ubuntu):
status: New → Invalid
Christian Kastner (ckk) wrote :

Addendum: I wasn't aware that Fedora implemented this differently -- although it is not surprising as /etc/cron.d/ not part of any official spec but rather an extension that was added by the individual distros.

I have this issue noted for now; perhaps something can be done via log levels in future. It's not as easy as it sounds, as on Ubuntu/Debian, we ignore files with dots for a reason (eg: .dpkg-dist files).

Robert Townley (robertjtownley) wrote :

Actually, /etc/cron.d/ is part of Linux Standards Base Core Specification 4.0.

Yes, .dpkg-* are ignored for a reason, but that also ignores the LSB FHS. If you installed the lsb packages and expect a Linux Standards Base system, then
`run-parts --verbose --lsbsysinit /etc/cron.hourly/`
should accept `` and `` and `job.cron` and other filenames with dots.

       If the --lsbsysinit option is given, then the names must not end in
       .dpkg-old or .dpkg-dist or .dpkg-new or .dpkg-tmp, and must belong to
       one or more of the following namespaces: the LANANA-assigned namespace
       (^[a-z0-9]+$); the LSB hierarchical and reserved namespaces
       (^_?([a-z0-9_.]+-)+[a-z0-9]+$); and the Debian cron script namespace
-Linux assigned names says to use names when you do not have a registered name for a particular project.

Robert Townley (robertjtownley) wrote :

It is actually documented further down in the man page and by the that these files can have dots, in fact, multiple dots to accomodate dns domain names.

Changed in cron (Ubuntu):
status: Invalid → Confirmed
WinEunuchs2Unix (ricklee518) wrote :

I have multiple files with the same names that serve different purposes. I need to differentiate them with extensions of `.sh`, `.cron` and `.sysd` so the `locate` command returns sane results. If I have to use `/etc/cron.d/myfile-cron` it spoils the file extension naming convention with `/usr/local/bin/` and `/lib/systemd/system-sleep/myfile.sysd`.

As per Ask Ubuntu question today:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers