On 03/16/2010 10:11 AM, Jeff wrote:
> On Tue, Mar 16, 2010 at 9:15 AM, Timothy Murphy<gayleard@eircom.net> wrote:
>> For some reason I cannot fathom,
>> cron.hourly runs twice each hour
>> on one of my two CentOS-5.4 systems,
>> as reported in /var/log/cron:
>> -------------------------
>> Mar 16 14:01:01 helen crond[27833]: (root) CMD (run-parts /etc/cron.hourly)
>> Mar 16 14:01:01 helen crond[27834]: (root) CMD (run-parts /etc/cron.hourly)
>> -------------------------
>> On the other it just runs once, as expected.
>> -------------------------
>> Mar 16 13:01:01 althea crond[23373]: (root) CMD (run-parts /etc/cron.hourly)
>> Mar 16 14:01:01 althea crond[23553]: (root) CMD (run-parts /etc/cron.hourly)
>> Mar 16 15:01:01 althea crond[23695]: (root) CMD (run-parts /etc/cron.hourly)
>> -------------------------
>>
>> This doesn't have any bad effect,
>> but it does run the scripts in /etc/cron.hourly twice.
>>
>> I just wonder if anyone has come across this curiosity?
>> Or can suggest any possible cause.
>
> hourly, daily, weekly and monthly jobs are configured in /etc/crontab.
> What's your /etc/crontab look like? Are you seeing the same behavior
> for daily/weekly jobs? Have you simply tried restarting the cron
> service?
Also, make sure that cron.hourly is _not_ run from /etc/anacrontab or
from any of the crontabs in /var/spool/cron.
--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 06:46 AM
Michael Schumacher
cron.hourly runs twice
Timothy,
On Tuesday, March 16, 2010 you wrote:
> Mar 16 14:01:01 helen crond[27833]: (root) CMD (run-parts /etc/cron.hourly)
> Mar 16 14:01:01 helen crond[27834]: (root) CMD (run-parts /etc/cron.hourly)
> I just wonder if anyone has come across this curiosity?
> Or can suggest any possible cause.
Did you edit one of the jobs? Some Editors (joe) create a file with an
"~" at the end as a backup. If you edit one of your cronjob-scripts
in /etc/cron.hourly/ , you may create a second file that will be run
by cron too.
This happened here some time ago and it took some time to figure out
the reason.
best regards
---
Michael Schumacher
PAMAS Partikelmess- und Analysesysteme GmbH
Dieselstr.10, D-71277 Rutesheim
Tel +49-7152-99630
Fax +49-7152-996333
Geschäftsführer: Gerhard Schreck
Handelsregister B Stuttgart HRB 252024
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 11:21 AM
Timothy Murphy
cron.hourly runs twice
Jeff wrote:
>> For some reason I cannot fathom,
>> cron.hourly runs twice each hour
>> on one of my two CentOS-5.4 systems,
> hourly, daily, weekly and monthly jobs are configured in /etc/crontab.
> What's your /etc/crontab look like? Are you seeing the same behavior
> for daily/weekly jobs? Have you simply tried restarting the cron
> service?
I have indeed - several times,
as well as re-booting the system.
My crontab is the original, I think:
---------------------------------
[root@helen tim]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
1 65 cron.daily run-parts /etc/cron.daily
7 70 cron.weekly run-parts /etc/cron.weekly
30 75 cron.monthly run-parts /etc/cron.monthly
---------------------------------
I see now that /etc/cron.daily also runs twice:
---------------------------------
Mar 16 04:01:02 helen crond[22696]: (root) CMD (run-parts /etc/cron.hourly)
Mar 16 04:01:02 helen crond[22699]: (root) CMD (run-parts /etc/cron.hourly)
Mar 16 04:02:01 helen crond[22723]: (root) CMD (run-parts /etc/cron.daily)
Mar 16 04:02:01 helen crond[22724]: (root) CMD (run-parts /etc/cron.daily)
Mar 16 04:02:01 helen anacron[22742]: Updated timestamp for job `cron.daily'
to 2010-03-16
Mar 16 04:02:11 helen anacron[23204]: Updated timestamp for job `cron.daily'
to 2010-03-16
---------------------------------
crond is only running once:
---------------------------------
[root@helen tim]# ps aux | grep cron
root 5978 0.0 0.0 61152 732 pts/1 S+ 12:15 0:00 grep cron
root 16700 0.0 0.0 74816 1236 ? Ss Mar15 0:01 crond
---------------------------------
I remain mystified ...
--
Timothy Murphy
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 11:25 AM
Timothy Murphy
cron.hourly runs twice
Michael Schumacher wrote:
>> I just wonder if anyone has come across this curiosity?
>> Or can suggest any possible cause.
>
> Did you edit one of the jobs? Some Editors (joe) create a file with an
> "~" at the end as a backup. If you edit one of your cronjob-scripts
> in /etc/cron.hourly/ , you may create a second file that will be run
> by cron too.
> This happened here some time ago and it took some time to figure out
> the reason.
Thanks for the suggestion.
I haven't edited any of the scripts in /etc/cron.hourly .
Also, I checked and found that cron.hourly starts twice
before any of the scripts starts.
Each of the scripts then runs twice.
--
Timothy Murphy
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 11:59 AM
Michael Schumacher
cron.hourly runs twice
Timothy,
On Wednesday, March 17, 2010 you wrote:
>>> For some reason I cannot fathom,
>>> cron.hourly runs twice each hour
>>> on one of my two CentOS-5.4 systems,
Here comes a very weird idea. I don't know the internals of the
cron-daemon good enough to know if this can actually happen.
If you have a NTP-job every hour started by cron that corrects the
internal time and if your internal clock runs too fast, the system
time may be reset every hour so that the cron-job will start twice. As
I said, I don't know if cron-daemon has a mechanism that would avoid
that problem.
best regards
---
Michael Schumacher
PAMAS Partikelmess- und Analysesysteme GmbH
Dieselstr.10, D-71277 Rutesheim
Tel +49-7152-99630
Fax +49-7152-996333
Geschäftsführer: Gerhard Schreck
Handelsregister B Stuttgart HRB 252024
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 12:13 PM
"Jason Pyeron"
cron.hourly runs twice
> -----Original Message-----
> From: centos-bounces@centos.org
> [mailto:centos-bounces@centos.org] On Behalf Of Michael Schumacher
> Sent: Wednesday, March 17, 2010 9:00
> To: CentOS mailing list
> Subject: Re: [CentOS] cron.hourly runs twice
>
> Timothy,
>
> On Wednesday, March 17, 2010 you wrote:
>
> >>> For some reason I cannot fathom,
> >>> cron.hourly runs twice each hour
> >>> on one of my two CentOS-5.4 systems,
>
Need to get a look into the runtime environment:
Add this to the cron.hourly
#!/bin/sh
pstree -up >> /tmp/foo.log
Next hour look at the parents (and their pids).
> Here comes a very weird idea. I don't know the internals of
> the cron-daemon good enough to know if this can actually happen.
> If you have a NTP-job every hour started by cron that
> corrects the internal time and if your internal clock runs
> too fast, the system time may be reset every hour so that the
> cron-job will start twice. As I said, I don't know if
> cron-daemon has a mechanism that would avoid that problem.
>
>
> best regards
> ---
> Michael Schumacher
> PAMAS Partikelmess- und Analysesysteme GmbH Dieselstr.10,
> D-71277 Rutesheim Tel +49-7152-99630 Fax +49-7152-996333
> Geschäftsführer: Gerhard Schreck
> Handelsregister B Stuttgart HRB 252024
>
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -
- Jason Pyeron PD Inc. http://www.pdinc.us -
- Principal Consultant 10 West 24th Street #100 -
- +1 (443) 269-1555 x333 Baltimore, Maryland 21218 -
- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 01:27 PM
cron.hourly runs twice
Timothy wrote:
> Michael Schumacher wrote:
>
>>> I just wonder if anyone has come across this curiosity?
>>> Or can suggest any possible cause.
>>
>> Did you edit one of the jobs? Some Editors (joe) create a file with an
>> "~" at the end as a backup. If you edit one of your cronjob-scripts
>> in /etc/cron.hourly/ , you may create a second file that will be run
>> by cron too.
>> This happened here some time ago and it took some time to figure out
>> the reason.
>
> Thanks for the suggestion.
> I haven't edited any of the scripts in /etc/cron.hourly .
> Also, I checked and found that cron.hourly starts twice
> before any of the scripts starts.
> Each of the scripts then runs twice.
This finally hit: under no circumstances should you be editing your
crontab with vi in the directory. ALWAYS use crontab -e.
Another thing, and this constantly irritates me: ll, in CentOS, seems to
be ls -l,*not* ls -la, and so doesn't show .files; have you looked for
those?
mark
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 09:04 PM
Timothy Murphy
cron.hourly runs twice
Jason Pyeron wrote:
>> >>> For some reason I cannot fathom,
>> >>> cron.hourly runs twice each hour
>> >>> on one of my two CentOS-5.4 systems,
>
> Add this to the cron.hourly
>
> #!/bin/sh
> pstree -up >> /tmp/foo.log
I tried this; the relevant lines on the first machine are:
-----------------------------------------
|-crond(9167)-+-crond(9439)---run-parts(9441)-+-awk(9452)
| | `-foo(9450)---
pstree(9451)
| `-crond(9440)---run-parts(9442)-+-awk(9455)
| `-foo(9454)---
pstree(9456)
|-cupsd(5301)---{cupsd}(17775)
-----------------------------------------
and on the other CentOS machine:
-----------------------------------------
|-crond(2824)---crond(28255)---run-parts(28256)---foo(28257)---
pstree(28258)
-----------------------------------------
I've checked that /etc/rc.d/init.d/crond on the two machines
are the same.
So too is /etc/sysconfig/crond .
I'm not clear why crond starts another copy of crond,
even on the second machine?
--
Timothy Murphy
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 09:20 PM
"Jason Pyeron"
cron.hourly runs twice
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -
- Jason Pyeron PD Inc. http://www.pdinc.us -
- Principal Consultant 10 West 24th Street #100 -
- +1 (443) 269-1555 x333 Baltimore, Maryland 21218 -
- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.
> -----Original Message-----
> From: centos-bounces@centos.org
> [mailto:centos-bounces@centos.org] On Behalf Of Timothy Murphy
> Sent: Wednesday, March 17, 2010 18:05
> To: centos@centos.org
> Subject: Re: [CentOS] cron.hourly runs twice
>
> Jason Pyeron wrote:
>
> >> >>> For some reason I cannot fathom,
> >> >>> cron.hourly runs twice each hour
> >> >>> on one of my two CentOS-5.4 systems,
> >
> > Add this to the cron.hourly
> >
> > #!/bin/sh
> > pstree -up >> /tmp/foo.log
>
> I tried this; the relevant lines on the first machine are:
> -----------------------------------------
> |-crond(9167)-+-crond(9439)---run-parts(9441)-+-awk(9452)
> | | `-foo(9450)---
> pstree(9451)
> | `-crond(9440)---run-parts(9442)-+-awk(9455)
> | `-foo(9454)---
> pstree(9456)
> |-cupsd(5301)---{cupsd}(17775)
> -----------------------------------------
> and on the other CentOS machine:
> -----------------------------------------
>
Good, what I thought
> |-crond(2824)---crond(28255)---run-parts(28256)---foo(28257)---
> pstree(28258)
> -----------------------------------------
>
> I've checked that /etc/rc.d/init.d/crond on the two machines
> are the same.
> So too is /etc/sysconfig/crond .
>
> I'm not clear why crond starts another copy of crond, even on
> the second machine?
>
Please send output of:
for i in /etc/crontab /var/spool/cron/*; do echo $i && cat $i; done
Local time changes of less than three hours, such as those caused by the
start or end of Daylight Saving Time, are handled specially. This only
applies to jobs that run at a specific time and jobs that are run with a
granularity greater than one hour. Jobs that run more frequently are scheduled
normally.
If time has moved forward, those jobs that would have run in the interval
that has been skipped will be run immediately. Conversely, if time has moved
backward, care is taken to avoid running jobs twice.
Time changes of more than 3 hours are considered to be corrections
to the clock or timezone, and the new time is used immediately.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-17-2010, 10:17 PM
Timothy Murphy
cron.hourly runs twice
Jason Pyeron wrote:
> Please send output of:
>
> for i in /etc/crontab /var/spool/cron/*; do echo $i && cat $i; done
Thank you very much.
That seems indeed to be the solution.
On the first machine I have:
-------------------------------------------
[root@helen tmp]# for i in /etc/crontab /var/spool/cron/*; do echo $i &&
cat $i; done
/etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
So it seems that entry at /var/spool/cron/root
is the cause of the problem.
I've no idea where it came from;
I guess I must have copied at some time -
I see the file is dated 1 March.
--
Timothy Murphy
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos