From: Jim Osborn
Date: Thu, 21 Dec 2000 14:34:13 -0800 (PST)
Message-Id: <200012212234.OAA03915@eskimo.com>
Subject: setting TOD for cron.daily and friends
The run-crons script does the magic that makes all the
/etc/cron.{hourly,daily,weekly,monthly} directories function
as their names imply. In my SuSE 6.3 installation, it's
invoked in /etc/crontab by the following line:
*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons
that is, every fifteen minutes. This script works with time
differentials, doing the various directories' tasks X minutes
or days after the last time they were done, as denoted by
marker files in /var/cron/lastrun.
I'd like the housekeeping chores of /etc/cron.daily/aaa_base
to run at 3am, but I don't see a graceful way to establish
that time of day as the base for run-crons, no setting in
rc.config etc. As it is, the TOD is set to the last edit
of /etc/crontab, and that's NOT what I want---housekeeping
in mid-morning, or early evening, or whatever...
I see two solutions:
1: comment out the /etc/crontab line, remove /var/cron/lastrun/*
and schedule run-crons as an at job at 3am tomorrow. Then
WITHIN 24hrs (!) uncomment the crontab line. Crude, inelegant
but it should work. Might need to be done again after some
kinds of system upgrades, or whatever.
2: hack the run-crons script to look for an init marker file
and schedule a touch of this file as the at job. This would
eliminate the need to spread the initialization process over
two closely-spaced manual tasks. More work, but cleaner in
the end.
But surely others have dealt with this problem before; I
must be reinventing the wheel here. How do others establish
the time of day their cron.daily tasks run?
TIA,
Jim