Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#27584 - [Cronie] daemon (cronie) starts cron jobs an hour before the actual time on PogoPlug

Attached to Project: Arch Linux
Opened by ilnli (ilnli) - Thursday, 15 December 2011, 14:15 GMT
Last edited by Gaetan Bisson (vesath) - Saturday, 24 December 2011, 16:22 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Gaetan Bisson (vesath)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Cron daemon is starting jobs an hour earlier than the actual time is set to run the job.

Additional info:
* package version(s): cronie 1.4.8-1
* config and/or log files etc.

# crontab -l
0 0 * * * /usr/bin/rsnapshot daily

# grep 'rsnapshot daily' /var/log/crond.log
Dec 11 23:00:02 imran-plug /USR/SBIN/CROND[31218]: (root) CMD (/usr/bin/rsnapshot daily)
Dec 12 23:00:01 imran-plug /USR/SBIN/CROND[22050]: (root) CMD (/usr/bin/rsnapshot daily)
Dec 13 23:00:01 imran-plug /USR/SBIN/CROND[12658]: (root) CMD (/usr/bin/rsnapshot daily)
Dec 14 23:00:01 imran-plug /USR/SBIN/CROND[3769]: (root) CMD (/usr/bin/rsnapshot daily)

# uname -a
Linux imran-plug 3.1.4-2-ARCH #1 PREEMPT Sun Dec 4 06:28:18 UTC 2011 armv5tel Feroceon 88FR131 rev 1 (v5l) Marvell SheevaPlug Reference Board GNU/Linux

Steps to reproduce:
1. Set up a cron job to run at 12AM (this could be any time)
2. Wait for the job to run successfully
3. Check /var/log/cron.log file and check the actual time of job execution, which will be an hour before the time set in crontab.
This task depends upon

Closed by  Gaetan Bisson (vesath)
Saturday, 24 December 2011, 16:22 GMT
Reason for closing:  Works for me
Comment by Jan de Groot (JGC) - Thursday, 15 December 2011, 15:21 GMT
Let me guess: you're in UTC+1 timezone and syslog is started before the timezone setting is applied.
Comment by ilnli (ilnli) - Thursday, 15 December 2011, 15:41 GMT
Here's some more info:

# grep -y utc /etc/rc.conf
HARDWARECLOCK="UTC"

# grep -y timezone /etc/rc.conf
TIMEZONE="Europe/London"

# date
Thu Dec 15 15:39:24 GMT 2011


I've even checked this manually and found out that the cron job starts 1 hour early, so it doesn't look to be UTC issue.
Comment by Gaetan Bisson (vesath) - Thursday, 15 December 2011, 22:35 GMT
Could you use "date >> /tmp/execution-dates-from-cronies-viewpoint" as a crontab?
Comment by ilnli (ilnli) - Friday, 16 December 2011, 00:33 GMT
Yes, here's the result.

# cat /tmp/execution-dates-from-cronies-viewpoint
Fri Dec 16 00:31:01 GMT 2011
# date
Fri Dec 16 00:31:11 GMT 2011

#tail -n 1 /var/log/crond.log
Dec 16 00:31:01 imran-plug /USR/SBIN/CROND[2417]: (root) CMD (/bin/date >> /tmp/execution-dates-from-cronies-viewpoint)

# crontab -l
* * * * * /bin/date >> /tmp/execution-dates-from-cronies-viewpoint

So the problem occurs when you give it specific time of the day to run the job.

I'll run the job after every hour and will see if that makes any difference (will put the results for that tomorrow).
Comment by ilnli (ilnli) - Friday, 16 December 2011, 09:09 GMT
Here are the results that I got:

# crontab -l
0 2 * * * /bin/date >> /tmp/execution-dates-from-cronies-viewpoint
0 4 * * * /bin/date >> /tmp/execution-dates-from-cronies-viewpoint
0 6 * * * /bin/date >> /tmp/execution-dates-from-cronies-viewpoint
0 8 * * * /bin/date >> /tmp/execution-dates-from-cronies-viewpoint

# cat /tmp/execution-dates-from-cronies-viewpoint
Fri Dec 16 02:00:01 GMT 2011
Fri Dec 16 04:00:01 GMT 2011
Fri Dec 16 06:00:02 GMT 2011
Fri Dec 16 08:00:01 GMT 2011

# grep execution-dates-from-cronies-viewpoint /var/log/crond.log
Dec 16 02:00:01 imran-plug /USR/SBIN/CROND[3890]: (root) CMD (/bin/date >> /tmp/execution-dates-from-cronies-viewpoint)
Dec 16 04:00:01 imran-plug /USR/SBIN/CROND[8435]: (root) CMD (/bin/date >> /tmp/execution-dates-from-cronies-viewpoint)
Dec 16 06:00:01 imran-plug /USR/SBIN/CROND[10183]: (root) CMD (/bin/date >> /tmp/execution-dates-from-cronies-viewpoint)
Dec 16 08:00:01 imran-plug /USR/SBIN/CROND[11933]: (root) CMD (/bin/date >> /tmp/execution-dates-from-cronies-viewpoint)


Looks like this one might have run on time but I haven't checked its execution time manually, however my old job still starts one hour before it's set time.

# crontab -l
0 0 * * * /usr/bin/rsnapshot daily

# grep rsnapshot /var/log/crond.log
Dec 15 23:00:01 imran-plug /USR/SBIN/CROND[5421]: (root) CMD (/usr/bin/rsnapshot daily)


Comment by Gaetan Bisson (vesath) - Friday, 16 December 2011, 14:43 GMT
May I suggest you try with `0 0 * * * /bin/date >> /tmp/getting-to-the-bottom-of-this`? For me it runs at midnight as expected.
Comment by ilnli (ilnli) - Friday, 16 December 2011, 21:18 GMT
I'll paste the results tonight.
Comment by ilnli (ilnli) - Saturday, 17 December 2011, 00:01 GMT
It looks like the problem was because of the following cron entry:

# crontab -l
0 * * * * /usr/bin/ntpdate tick.greyware.com > /dev/null 2>&1

I made that to:

# crontab -l
30 * * * * /usr/bin/ntpdate tick.greyware.com > /dev/null 2>&1

and it's now running the jobs on their set time.
Comment by Gaetan Bisson (vesath) - Saturday, 17 December 2011, 02:33 GMT
Right. So ntpdate was messing with your clock momentarily. I suggest you use ntpd instead.
Comment by ilnli (ilnli) - Tuesday, 20 December 2011, 19:02 GMT
Hi,

Could you please reopen this because the problem still exists, it might have been fixed only for one day but now it's again happening however this time I don't even have ntpd in my cron entries.

Following is some more info:

# grep rsnapshot /var/log/crond.log
Dec 18 23:00:01 imran-plug /USR/SBIN/CROND[10134]: (root) CMD (/usr/bin/rsnapshot daily)
Dec 19 23:00:01 imran-plug /USR/SBIN/CROND[31205]: (root) CMD (/usr/bin/rsnapshot daily)

# crontab -l
0 0 * * * /usr/bin/rsnapshot daily
0 4 * * 6 /usr/bin/rsnapshot weekly
0 8 1 * * /usr/bin/rsnapshot monthly
*/5 * * * * /usr/bin/sudo -u http /usr/bin/php /srv/http/cacti/poller.php > /dev/null 2>&1
0 0 * * * /usr/bin/faillog -r

# find /etc/cron.*
/etc/cron.d
/etc/cron.d/0hourly
/etc/cron.daily
/etc/cron.daily/shadow
/etc/cron.daily/logrotate
/etc/cron.daily/man-db
/etc/cron.daily/sysstat
/etc/cron.deny
/etc/cron.hourly
/etc/cron.hourly/sysstat
/etc/cron.hourly/0anacron
/etc/cron.hourly/date.sync
/etc/cron.monthly
/etc/cron.weekly

# date
Tue Dec 20 15:00:06 GMT 2011

# grep "DAEMONS=" /etc/rc.conf
DAEMONS=(syslog-ng network netfs crond sshd samba mysqld postfix lighttpd ntpd)
Comment by ilnli (ilnli) - Tuesday, 20 December 2011, 19:02 GMT
Hi,

Could you please reopen this because the problem still exists, it might have been fixed only for one day but now it's again happening however this time I don't even have ntpd in my cron entries.

Following is some more info:

# grep rsnapshot /var/log/crond.log
Dec 18 23:00:01 imran-plug /USR/SBIN/CROND[10134]: (root) CMD (/usr/bin/rsnapshot daily)
Dec 19 23:00:01 imran-plug /USR/SBIN/CROND[31205]: (root) CMD (/usr/bin/rsnapshot daily)

# crontab -l
0 0 * * * /usr/bin/rsnapshot daily
0 4 * * 6 /usr/bin/rsnapshot weekly
0 8 1 * * /usr/bin/rsnapshot monthly
*/5 * * * * /usr/bin/sudo -u http /usr/bin/php /srv/http/cacti/poller.php > /dev/null 2>&1
0 0 * * * /usr/bin/faillog -r

# find /etc/cron.*
/etc/cron.d
/etc/cron.d/0hourly
/etc/cron.daily
/etc/cron.daily/shadow
/etc/cron.daily/logrotate
/etc/cron.daily/man-db
/etc/cron.daily/sysstat
/etc/cron.deny
/etc/cron.hourly
/etc/cron.hourly/sysstat
/etc/cron.hourly/0anacron
/etc/cron.hourly/date.sync
/etc/cron.monthly
/etc/cron.weekly

# date
Tue Dec 20 15:00:06 GMT 2011

# grep "DAEMONS=" /etc/rc.conf
DAEMONS=(syslog-ng network netfs crond sshd samba mysqld postfix lighttpd ntpd)
Comment by Gaetan Bisson (vesath) - Tuesday, 20 December 2011, 22:17 GMT
What is that script? /etc/cron.hourly/date.sync
Comment by ilnli (ilnli) - Wednesday, 21 December 2011, 09:30 GMT
Hmm! that script has following contents in it.


=====================
#!/bin/bash

ntpdate tick.greyware.com > /dev/null 2>&1
=====================

I didn't realize it's still there.

It could have been that script causing the problem, let me run without that script and I'll paste the results here.
Comment by ilnli (ilnli) - Thursday, 22 December 2011, 23:45 GMT
Here are the latest logs, the job is till starting at 23:00 rather than 00:00

# find /etc/cron*
/etc/cron.d
/etc/cron.d/0hourly
/etc/cron.daily
/etc/cron.daily/shadow
/etc/cron.daily/logrotate
/etc/cron.daily/man-db
/etc/cron.daily/sysstat
/etc/cron.deny
/etc/cron.hourly
/etc/cron.hourly/sysstat
/etc/cron.hourly/0anacron
/etc/cron.monthly
/etc/cron.weekly

# crontab -l
0 0 * * * /usr/bin/rsnapshot daily
0 4 * * 6 /usr/bin/rsnapshot weekly
0 8 1 * * /usr/bin/rsnapshot monthly
*/5 * * * * /usr/bin/sudo -u http /usr/bin/php /srv/http/cacti/poller.php > /dev/null 2>&1
0 0 * * * /usr/bin/faillog -r

# grep rsnapshot /var/log/crond.log
Dec 21 23:00:01 imran-plug /USR/SBIN/CROND[13460]: (root) CMD (/usr/bin/rsnapshot daily)
Dec 22 23:00:01 imran-plug /USR/SBIN/CROND[17403]: (root) CMD (/usr/bin/rsnapshot daily)
Comment by Gaetan Bisson (vesath) - Friday, 23 December 2011, 01:28 GMT
Could we finally try `x y * * * /bin/date >> /tmp/getting-to-the-bottom-of-this` for (x,y) in (0,23), (59,23), (0,0), (1,0), and (0,1)?
It's really not helping to re-paste the same data each time: try with something else than rsnapshot, try skimming down your cronie configuration and crontabs as much as you can until you cannot reproduce the problem anymore, etc.
Comment by ilnli (ilnli) - Friday, 23 December 2011, 09:01 GMT
Ok, I'll get that data tonight.
Comment by ilnli (ilnli) - Saturday, 24 December 2011, 09:51 GMT
Here are he results from the above:

# crontab -l | grep getting-to-the-bottom-of-this
0 23 * * * /bin/date >> /root/getting-to-the-bottom-of-this
59 23 * * * /bin/date >> /root/getting-to-the-bottom-of-this
0 0 * * * /bin/date >> /root/getting-to-the-bottom-of-this
1 0 * * * /bin/date >> /root/getting-to-the-bottom-of-this
0 1 * * * /bin/date >> /root/getting-to-the-bottom-of-this

# grep getting-to-the-bottom-of-this /var/log/crond.log
Dec 23 22:00:01 imran-plug /USR/SBIN/CROND[23734]: (root) CMD (/bin/date >> /root/getting-to-the-bottom-of-this)
Dec 23 22:59:01 imran-plug /USR/SBIN/CROND[24604]: (root) CMD (/bin/date >> /root/getting-to-the-bottom-of-this)
Dec 23 23:00:01 imran-plug /USR/SBIN/CROND[24613]: (root) CMD (/bin/date >> /root/getting-to-the-bottom-of-this)
Dec 23 23:01:01 imran-plug /USR/SBIN/CROND[24689]: (root) CMD (/bin/date >> /root/getting-to-the-bottom-of-this)
Dec 24 00:00:02 imran-plug /USR/SBIN/CROND[25488]: (root) CMD (/bin/date >> /root/getting-to-the-bottom-of-this)

# cat /root/getting-to-the-bottom-of-this
Fri Dec 23 22:00:01 GMT 2011
Fri Dec 23 22:59:01 GMT 2011
Fri Dec 23 23:00:02 GMT 2011
Fri Dec 23 23:01:01 GMT 2011
Sat Dec 24 00:00:02 GMT 2011

# date
Sat Dec 24 09:50:37 GMT 2011
Comment by Gaetan Bisson (vesath) - Saturday, 24 December 2011, 13:41 GMT
Do you realize that this info contradicts that you posted on Friday, 16 December 2011, 10:09 GMT+1?
So I don't know what's wrong on your computer but unless you can make the issue reproducible yourself there's no way I'm going to be able to debug this.
Comment by ilnli (ilnli) - Saturday, 24 December 2011, 14:36 GMT
Hi Gaetan,

Thanks for your time, basically I removed those entries from the cron which were running ntpdate which I previously thought might be causing the problem but even after removing those ntpupdate entries the problem still persists.

I'll look into the source of cronie and will try see what's wrong.

Once again thanks for looking into this problem, you may close this defect.

Cheers
Comment by Gaetan Bisson (vesath) - Saturday, 24 December 2011, 16:22 GMT
Alright. If you find that this is actually a packaging problem, do not hesitate to create a new ticket with your findings. Good luck.

Loading...