[Bug 1819369] Re: When specifying minute, hour, day-of-month, month, day-of-week values/ranges, given day-of-month range is *ignored*
Christian Kastner
1819369 at bugs.launchpad.net
Sun Mar 10 20:32:55 UTC 2019
On 10.03.19 21:05, Markus Ueberall wrote:
> # m h dom mon dow user command
> 00 05 1-7 1,3,5,7,9,11 SAT sys-maint some-task some-option #host1
> 00 05 8-14 1,3,5,7,9,11 SAT sys-maint some-task some-option #host2
> 00 05 15-21 1,3,5,7,9,11 SAT sys-maint some-task some-option #host3
> 00 05 22-28 1,3,5,7,9,11 SAT sys-maint some-task some-option #host4
> The expectation was that none of the entries is executed in parallel
> at any given point in time due to column three> (day-of-month range)
This frequently occurring mistake is an unfortunate result of the
crontab(5) specification.
Quoting the man page:
> Note: The day of a command's execution can be specified by two fields —
> day of month, and day of week. If both fields are restricted (i.e.,
> aren't *), the command will be run when either field matches the current
> time. For example, ``30 4 1,15 * 5'' would cause a command to be run at
> 4:30 am on the 1st and 15th of each month, plus every Friday.
In short: it's not dom AND dow, but dom OR dow.
Consequently, your specification of SAT in column 5 trumps your
specification of column 3.
The man page contains an example for how to work around this.
--
Christian Kastner
** Changed in: cron (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to cron in Ubuntu.
https://bugs.launchpad.net/bugs/1819369
Title:
When specifying minute,hour,day-of-month,month,day-of-week
values/ranges, given day-of-month range is *ignored*
Status in cron package in Ubuntu:
Invalid
Bug description:
1) The release of Ubuntu you are using, via 'lsb_release -rd'
# lsb_release -rd
Description: Ubuntu 16.04.6 LTS
Release: 16.04
2) The version of the package you are using, via 'apt-cache policy pkgname'
# apt-cache policy cron
cron:
Installed: 3.0pl1-128ubuntu2
Candidate: 3.0pl1-128ubuntu2
Version table:
*** 3.0pl1-128ubuntu2 500
500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
3) What you expected to happen
/etc/crontab contains the following entries (each line lives on a separate host with identical setup, system clocks are in sync):
# m h dom mon dow user command
00 05 1-7 1,3,5,7,9,11 SAT sys-maint some-task some-option #host1
00 05 8-14 1,3,5,7,9,11 SAT sys-maint some-task some-option #host2
00 05 15-21 1,3,5,7,9,11 SAT sys-maint some-task some-option #host3
00 05 22-28 1,3,5,7,9,11 SAT sys-maint some-task some-option #host4
The expectation was that none of the entries is executed in parallel
at any given point in time due to column three (day-of-month range).
(Note: All other (default) entries work as expected, syntax of all
crontab files has been checked using
https://code.google.com/archive/p/chkcrontab/wikis/CheckCrontab.wiki)
4) What happened instead
Yesterday (Saturday, March 9th), the same script was executed in parallel on all four hosts.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cron/+bug/1819369/+subscriptions
More information about the foundations-bugs
mailing list