From owner-freebsd-hackers Sun Sep 16 20: 8:14 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.gbch.net (gw.gbch.net [203.24.22.66]) by hub.freebsd.org (Postfix) with SMTP id CC8C137B40B for ; Sun, 16 Sep 2001 20:08:02 -0700 (PDT) Received: (qmail 92928 invoked by uid 1001); 17 Sep 2001 13:07:59 +1000 Message-ID: X-Posted-By: GJB-Post 2.21 16-Jun-2001 X-Operating-System: FreeBSD 4.2-RELEASE i386 X-Location: Brisbane, Australia; 27.49841S 152.98439E X-URL: http://www.gbch.net/gjb.html X-Image-URL: http://www.gbch.net/gjb/gjb-auug048.gif X-GPG-Fingerprint: EBB2 2A92 A79D 1533 AC00 3C46 5D83 B6FB 4B04 B7D6 X-PGP-Public-Keys: http://www.gbch.net/keys.html Date: Mon, 17 Sep 2001 13:07:59 +1000 From: Greg Black To: Eugene Grosbein Cc: Tim Allshorn , freebsd-hackers@freebsd.org Subject: Re: Cron pickle References: <20010917105932.A5338@svzserv.kemerovo.su> In-reply-to: <20010917105932.A5338@svzserv.kemerovo.su> of Mon, 17 Sep 2001 10:59:32 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Eugene Grosbein wrote: | On Mon, Sep 17, 2001 at 12:17:30PM +1000, Greg Black wrote: | | > | I need to be able to run a particular program at the last | > | minute of each month and yes I know it would be much easier to | > | run it at the first minute of each month, but my hands are tied | > | and my brain is too puny to work it out. | > | > This cannot be done with cron, even with multiple entries. You | > can use cron to schedule something for minute zero of each month | > and that should be good enough for any reasonable use. | | This can be done with cron with single entry and small overhead. | Run whis script at last minute of every day (or every 28-31): | | #!/bin/sh | | tomorrow=`date -v+1d %d` | if [ $tomorroq -ne "01" ]; then | exit # if tomorrow is not begin of month, do nothing | fi | | # do work now Sure: $ date -v+1d %d date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] $ date '-v+1d %d' +1d %d: Cannot apply date adjustment usage: date [-nu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] Assuming you actually figure out how to get this thing right, it makes my point -- you can't do this with a cron specification, but you have to do the decision-making in the program. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message