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

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

Bug Description

Binary package hint: cron

I configured cron jobs with config file:
  /etc/cron.d/job.cron
and it not working.
I spend couple of hours to understand the problem.
Fix is to rename file withowt dots in the name:
  /etc/cron.d/job
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:
http://manpages.ubuntu.com/manpages/maverick/en/man8/cron.8.html

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. http://refspecs.linux-foundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/etc.html

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 `org.debian.my.cron.job.sh` and `debian.org-cron.job.with.dots.sh` and `job.cron` and other filenames with dots.

http://manpages.ubuntu.com/manpages/trusty/en/man8/run-parts.8.html

       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
       (^[a-zA-Z0-9_-]+$).

http://refspecs.linux-foundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/etc.html#FHS-NAME-RULES
-Linux assigned names says to use dns.name.com names when you do not have a registered name for a particular project.
http://www.lanana.org/lsbreg/cron/index.html

Robert Townley (robertjtownley) wrote :

It is actually documented further down in the man page and by the linux-foundation.org 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/myfile.sh` and `/lib/systemd/system-sleep/myfile.sysd`.

As per Ask Ubuntu question today: https://askubuntu.com/questions/1020411/file-naming-conventions-for-cron-and-systemd-extensions

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

Other bug subscribers