setting TOD for cron.daily and friends
From: Jim Osborn <jimo@eskimo.com> 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
Date: Thu, 21 Dec 2000 18:06:56 -0600 From: "Robert C. Paulsen Jr." <paulsen@texas.net> Message-ID: <20001221180656.A13882@home.paulsen.org> Subject: Re: [SLE] setting TOD for cron.daily and friends On Thu, Dec 21, 2000 at 02:34:13PM -0800, Jim Osborn wrote:
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...
/etc/crontab on my SuSE 7.0 system looks like this... ======================================================================================= SHELL=/bin/sh PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin MAILTO=root #-* * * * * root test -x /usr/sbin/atrun && /usr/sbin/atrun 0 21 * * * root test -x /usr/sbin/faxqclean && /usr/sbin/faxqclean 5 22 * * * root test -x /usr/sbin/texpire && /usr/sbin/texpire 25 23 * * * root test -e /usr/sbin/faxcron && sh /usr/sbin/faxcron | mail FaxMaster # # check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly # -*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons 0 0 * * * root rm -f /var/spool/cron/lastrun/cron.daily 0 0 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly 0 0 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly ======================================================================================= I think the last three lines are there to force things to happen at midnight. Perhaps you could change the "0 0" entries to something like "0 3" to get what you want. I haven't experimented with this so perhaps I'm missing something, but I think that might do it. -- ____________________________________________________________________ Robert Paulsen paulsen@texas.net
participants (2)
-
jimo@eskimo.com
-
paulsen@texas.net