Gentoo Archives: gentoo-server

From: Alex Efros <powerman@×××××××.ua>
To: gentoo-server@l.g.o
Subject: [gentoo-server] cron: test -x /usr/sbin/run-crons && /usr/sbin/run-crons
Date: Wed, 28 Sep 2005 14:20:11
Message-Id: 20050928142032.GC10967@home.power
1 Hi!
2
3 On all my servers I receive from time to time (usually once in 5-30 days)
4 email with subject subj :) and content:
5 ---cut---
6 find: /var/spool/cron/lastrun/cron.hourly: No such file or directory
7 ---cut---
8
9 I suppose this is because of race condition somethere in /usr/sbin/run-crons.
10 Root's default crontab is:
11 ---cut---
12 */15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
13 0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
14 0 8 * * * rm -f /var/spool/cron/lastrun/cron.daily
15 15 11 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
16 30 12 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
17 ---cut---
18 and I think if first two lines from crontab will start at same time and
19 /usr/sbin/run-crons will check for existence of lastrun/cron.hourly
20 __BEFORE__ rm will remove it then race condition happens and result in
21 that email sent to root.
22
23 Can anybody confirm this?
24
25 If I'm right, then maybe better to change last 4 lines in crontab to not
26 run in %15 minute:
27 ---cut---
28 */15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
29 5 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
30 5 8 * * * rm -f /var/spool/cron/lastrun/cron.daily
31 20 11 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
32 35 12 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
33 ---cut---
34
35 --
36 WBR, Alex.
37 --
38 gentoo-server@g.o mailing list

Replies