Bug 157448 - logwatch anacrontab + crontab entries can let logwatch run too frequently
logwatch anacrontab + crontab entries can let logwatch run too frequently
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: anacron (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Marcela Mašláňová
Brock Organ
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-11 14:23 EDT by Jason Vas Dias
Modified: 2011-05-24 02:11 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-08-14 06:30:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jason Vas Dias 2005-05-11 14:23:41 EDT
Description of problem:

This bug was originally reported (incorrectly) as an addendum
to vixie-cron bug 138001, so I'm raising this bug on the issue:

------- Comments From sergiomb@netcabo.pt  2005-05-11 13:18 EST -----
Hi, this is the most similar bug that I can found.
I am using vixie-cron-4.1-33_FC3, 
when I turn on my laptop after midinight, May 11 02:46:56
logwatch start before the schedual and send the email from anonymous user ?
After this run at schedual time and send normally the email from root user.
After many time trying understand the problem, I realize this happens when I
reboot or power on my laptop after 0:00 am and before 4:02 am 
------

This sounds to me to be caused by anacron, as anacron jobs will send mail from
the anonymous user . 

Also cron does not check if anacron has run a job that is in 
both anacron and cron - this is a duplicate of bug 150228, which
will be fixed when I complete a major enhancement to vixie-cron
to replace functionality of anacron.

So until this enhancement is in place, it is up to crontab scripts
to check if they are run too frequently, as they may be invoked from
both anacrontab and from a crontab .

Also, anacrontabs did not support the "MAILTO=" variable.

anacron-2.3-32+ does support the MAILTO variable in anacrontab,
so perhaps logwatch should be setting this .


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Jason Vas Dias 2005-05-11 14:27:39 EDT
I've raised this bug for this problem originally reported as an addendum to
bug #138001, which wasn't a related bug . 

I'll investigate whether there is anything wrong with cron or anacron's 
behaviour that causes this problem, and am working on a vixie-cron enhancement
that would fix it, but for now it should be up to logwatch to prevent itself
being run too frequently.
Comment 2 Ivana Varekova 2005-06-30 05:23:16 EDT
I think this change could be problem becouse of logwatch is not destructive
programme it only creates log mail. So if logwatch run twice a day there is no
harm. And a user can run logwatch more often than daily.
I think if logwatch run twice a day there is not almost any problem (one more
mail). But if there will be any time stamp and time check user could not use
logwatch more often then daily and it is constraint. 
So I think this problem would not be fixed. 
If you don't make a protest I will close this bug. 
Comment 3 Sergio Monteiro Basto 2005-06-30 11:01:43 EDT
well this is my problem this running always when my laptop starts , like other
crons 
Comment 4 Sergio Monteiro Basto 2006-10-25 20:09:37 EDT
ok, maybe we could close this bug and report other bug in anacron ,
Finally I understand my problem and I think that is a bug
when I start or restart my computer  (laptop or desktop)  after 0.00 AM
(midnight) for example 
Oct 25 00:24:38 localhost crond[2464]: (CRON) STARTUP (V5.0)
Oct 25 00:24:39 localhost anacron[2500]: Anacron 2.3 started on 2006-10-25
Oct 25 00:24:39 localhost anacron[2500]: Will run job `cron.daily' in 65 min.
Oct 25 00:24:39 localhost anacron[2500]: Will run job `cron.weekly' in 70 min.
Oct 25 00:24:39 localhost anacron[2500]: Jobs will be executed sequentially

This is wrong cron.daily should start at 4.02 AM the hour that is write on
/etc/crontab
Comment 5 Marcela Mašláňová 2006-11-01 04:40:09 EST
Thanks for report. I thought that some jobs run twice. Now I try change time and
investigate what's the problem.
Comment 6 Sergio Monteiro Basto 2006-11-03 08:19:14 EST
well checking my logs on my laptop , I can see that logwatch still running twice 
the best example :
 ################### Logwatch 7.2.1 (01/18/06) ####################
        Processing Initiated: Mon Oct 16 03:58:59 2006
        Date Range Processed: yesterday
                              ( 2006-Oct-15 )
                              Period is day.
      Detail Level of Output: 0
              Type of Output: unformatted
           Logfiles for Host: segulix
  ##################################################################

and 

  ################### Logwatch 7.2.1 (01/18/06) ####################
        Processing Initiated: Mon Oct 16 04:02:20 2006
        Date Range Processed: yesterday
                              ( 2006-Oct-15 )
                              Period is day.
      Detail Level of Output: 0
              Type of Output: unformatted
           Logfiles for Host: segulix
  ##################################################################

but if you fix Comment #4, maybe will fix also this.
Comment 7 Marcela Mašláňová 2006-11-06 02:33:33 EST
Well yes, because logwatch is parsing file from comment#4 :)
Comment 8 Marcela Mašláňová 2006-11-07 10:31:50 EST
I can't reproduce this bug and have no idea how could be possible.
Could you send me all your crontab and anacrontab?
Comment 9 Sergio Monteiro Basto 2006-11-07 17:19:33 EST
I don't have change crontab neither anacrontab, just open laptop or reboot
laptop after midnight, after this, just cat /var/log/cron 
and you will see something like:
Oct 25 00:24:39 localhost anacron[2500]: Will run job `cron.daily' in 65 min.
Oct 25 00:24:39 localhost anacron[2500]: Will run job `cron.weekly' in 70 min.

which IMHO it is a bug cause should start at default crontab time which is 4:02 
Comment 10 Marcela Mašláňová 2006-11-14 08:48:58 EST
Ha! Now I see.
If you switch on computer cron search in cron.d/cron.daily and run jobs in
65minutes as you wrote.
If you don't switch off your computer and it's running more than one day, then
it's cron.daily run at 4:02 a.m. as you can see here:
Nov 14 03:01:01 local crond[2709]: (root) CMD (run-parts /etc/cron.hourly)
Nov 14 04:01:01 local crond[2832]: (root) CMD (run-parts /etc/cron.hourly)
Nov 14 04:02:01 local crond[2835]: (root) CMD (run-parts /etc/cron.daily)
Nov 14 04:02:01 local anacron[2838]: Updated timestamp for job `cron.daily' to
2006-11-14
Nov 14 05:01:01 local crond[4519]: (root) CMD (run-parts /etc/cron.hourly)
Nov 14 06:01:01 local crond[4619]: (root) CMD (run-parts /etc/cron.hourly)
Comment 11 Sergio Monteiro Basto 2006-11-14 09:37:22 EST
yap , but it is a bug on laptops, I have the luck that I can't reopen the bug.
Comment 12 Marcela Mašláňová 2006-11-14 09:45:40 EST
That's laptop or computer independent. It's not a bug, for more information use
man cron, anacron, anacrontab.
Comment 13 Sergio Monteiro Basto 2006-11-14 10:02:40 EST
so why  logwatch run twice ? and if I put a cron.daily to run to 18:00
why when I switch on my laptop on work after 65 minutes begin to run cron.daily , 
and run cron.daily twice a day ? 
I have to uninstall beagle, because I have to work after 65 minutes of switch on
my laptop.
And it is a bug when we want that works out of the box, on ordinary laptops.
Anacron have to check (when wake up) if the crons for this day have already past
if not, don't have to cron anything. 
if a laptop have been shutdown for some days, is correct running cron.weekly if
it is missed , but is not correct, laptop have all crons updated .
Comment 14 Marcela Mašláňová 2006-11-15 04:13:26 EST
I don't how it's possible, please try to upgrade. I'm planning some changes in
crons, maybe it helps.
Comment 15 Sergio Monteiro Basto 2006-11-15 08:42:09 EST
(In reply to comment #14)
> I don't how it's possible, please try to upgrade. I'm planning some changes in
> crons, maybe it helps.

I update fedora almost every day.
The solution is simple like that, when computer wake up see if have been missed
some schedule cron. if not, don't cron anything and waits for the crontab do his
job.
Sorry for my bad English!
Comment 16 Sergio Monteiro Basto 2007-08-03 23:33:52 EDT
root      1953     1  0 02:55 ?        00:00:00 crond
root      2013     1  0 02:55 ?        00:00:00 anacron -s
root      3381  2013  0 04:00 ?        00:00:00 /bin/bash /usr/bin/run-parts
/etc/cron.daily
root      3395  1953  0 04:02 ?        00:00:00 crond
root      3396  3395  0 04:02 ?        00:00:00 /bin/bash /usr/bin/run-parts
/etc/cron.daily

cat /var/log/cron
Aug  4 02:50:51 localhost anacron[2013]: Anacron 2.3 started on 2007-08-04
Aug  4 02:50:51 localhost anacron[2013]: Will run job `cron.daily' in 65 min.
Aug  4 02:50:51 localhost anacron[2013]: Jobs will be executed sequentially
Aug  4 03:03:19 localhost crond[2885]: (root) CMD (run-parts /etc/cron.hourly)
Aug  4 04:00:09 localhost anacron[2013]: Job `cron.daily' started
Aug  4 04:01:02 localhost crond[3394]: (root) CMD (run-parts /etc/cron.hourly)
Aug  4 04:02:01 localhost crond[3396]: (root) CMD (run-parts /etc/cron.daily)
Comment 17 Marcela Mašláňová 2007-08-09 03:03:52 EDT
I tried tu change scripts a bit and now I'm testing the behaviour of
anacron/cron jobs. I'd like to push it to F-8.
Comment 18 Marcela Mašláňová 2007-08-09 09:37:59 EDT
You can try anacron-2.3-49.fc8. I suppose that there should be still some
problems. Please let me know.
Comment 19 Sergio Monteiro Basto 2011-05-23 22:08:35 EDT
Hi, after four years, I found the mystery , I am writing to send my apologizes :)
  
I got a /etc/crontab.rpmnew and /etc/crontab still with old version:

cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 8 * * * root run-parts /etc/cron.daily
42 8 * * 0 root run-parts /etc/cron.weekly
42 9 1 * * root run-parts /etc/cron.monthly

so run-parts run always twice for cron.daily.

I keep upgrading the computer (*), don't use it to often. And on Fedora 14 by other problem I found this issue.

(*) well is not the computer is the data of the computer . 

Thanks, Sorry for my misunderstanding.
Comment 20 Marcela Mašláňová 2011-05-24 02:11:48 EDT
Thank you :)

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