Bug 1571407 - crontab weekly job isn't running on time
Summary: crontab weekly job isn't running on time
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cronie
Version: 7.7
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-24 17:35 UTC by Rupesh Patel
Modified: 2018-04-26 06:12 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-25 15:58:31 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Rupesh Patel 2018-04-24 17:35:41 UTC
## Packages

[root@rhel7-c2 ~]# rpm -qa | grep cronie
cronie-1.4.11-19.el7.x86_64
cronie-anacron-1.4.11-19.el7.x86_64
[root@rhel7-c2 ~]# 

## Cron entries to be run every Wed. (0 is Sun) 

[root@rhel7-c2 ~]# crontab -l
00 01 15-21 * 4 /bin/echo "test" >> /var/log/messages
[root@rhel7-c2 ~]# 

OR

[root@rhel7u4-2 ~]# crontab -l
00 01 15-21 * Wed /bin/echo "test" >> /var/log/messages
[root@rhel7u4-2 ~]# 

## Execute below command to reproduce error. (setting up date to Mon, restart crond, and check cron logs or messages file)

$ date -s 'Apr 16 00:59 IST 2018' ; sleep 1 ; systemctl restart crond; sleep 1; tailf /var/log/messages | grep test

## Output,

[root@rhel7-c2 ~]# date -s 'Apr 16 00:59 IST 2018' ; sleep 1 ; systemctl restart crond; sleep 1; tailf /var/log/messages | grep test
Mon Apr 16 00:59:00 IST 2018 <<<<<<<<<<<
test <<<<<<<<<<<<<<<<<<<
^C
[root@rhel7-c2 ~]# 

## Actual output,

Cron should never run before schedule time.

Comment 2 Tomas Mraz 2018-04-25 15:58:31 UTC
This is as designed and documented.

Citing crontab(5) man page:

Note:  The day of a command's execution can be specified in the follow‐
       ing two fields — 'day of month', and 'day of week'.  If both fields are
       restricted  (i.e.,  do not contain the "*" character), 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.


Note You need to log in before you can comment on or make changes to this bug.