Gentoo Archives: gentoo-server

From: Dark <dark@××××.dk>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] cron: test -x /usr/sbin/run-crons && /usr/sbin/run-crons
Date: Wed, 28 Sep 2005 20:30:21
Message-Id: 433AFCFC.2080706@w00p.dk
In Reply to: [gentoo-server] cron: test -x /usr/sbin/run-crons && /usr/sbin/run-crons by Alex Efros
1 Hello,
2
3 I can confirm it - I rarely open them, because my mailprogram will run
4 out of resources.
5 One difference though, I get them once every 24 hour (around midnight).
6
7 So I just figured that it was because I had done something bad with my
8 system :-)
9
10 My crontab as it is now:
11 --- begin
12 # Global variables
13 SHELL=/bin/bash
14 PATH=/sbin:/bin:/usr/sbin:/usr/bin
15 MAILTO=root
16 HOME=/
17
18 # check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
19 0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
20 1 3 * * * rm -f /var/spool/cron/lastrun/cron.daily
21 15 4 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
22 30 5 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
23 */10 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
24 0 0 * * * /usr/sbin/logwatch.pl >/dev/null 2>&1
25 0 0 * * * /etc/init.d/ntp-client restart >/dev/null 2>&1
26 --- end
27
28 And I know those two last lines look might weird, I've been too lazy to
29 change them.. They work.
30
31 /Jakob Rosenlund
32
33
34
35 Alex Efros wrote:
36
37 >Hi!
38 >
39 >On all my servers I receive from time to time (usually once in 5-30 days)
40 >email with subject subj :) and content:
41 >---cut---
42 >find: /var/spool/cron/lastrun/cron.hourly: No such file or directory
43 >---cut---
44 >
45 >I suppose this is because of race condition somethere in /usr/sbin/run-crons.
46 >Root's default crontab is:
47 >---cut---
48 >*/15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
49 >0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
50 >0 8 * * * rm -f /var/spool/cron/lastrun/cron.daily
51 >15 11 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
52 >30 12 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
53 >---cut---
54 >and I think if first two lines from crontab will start at same time and
55 >/usr/sbin/run-crons will check for existence of lastrun/cron.hourly
56 >__BEFORE__ rm will remove it then race condition happens and result in
57 >that email sent to root.
58 >
59 >Can anybody confirm this?
60 >
61 >If I'm right, then maybe better to change last 4 lines in crontab to not
62 >run in %15 minute:
63 >---cut---
64 >*/15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
65 >5 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
66 >5 8 * * * rm -f /var/spool/cron/lastrun/cron.daily
67 >20 11 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
68 >35 12 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
69 >---cut---
70 >
71 >
72 >
73
74 --
75 gentoo-server@g.o mailing list