From owner-freebsd-isp Tue Nov 4 16:29:31 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id QAA21850 for isp-outgoing; Tue, 4 Nov 1997 16:29:31 -0800 (PST) (envelope-from owner-freebsd-isp) Received: from capecod.net (poca37.capecod.net [205.230.13.37]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id QAA21819 for ; Tue, 4 Nov 1997 16:29:20 -0800 (PST) (envelope-from crtb@capecod.net) Received: from localhost (crtb@localhost) by capecod.net (8.8.5/8.8.5) with SMTP id TAA00617; Tue, 4 Nov 1997 19:00:38 -0500 (EST) Date: Tue, 4 Nov 1997 19:00:37 -0500 (EST) From: Chuck To: Eddie Fry cc: isp@FreeBSD.ORG Subject: Re: crons In-Reply-To: <199711032337.QAA11458@wicked.eaznet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Not sure how a shell script would do it, but in a perl script run at 1 min. after midnight, my @lastmonth = qw(Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov); my $time = time; # Nail down this precise moment my $moment = $time % 86400; # Exactly what time is it after midnight? complain ('bitterly', $time) if $moment > 3*60; # Did cron err? my $day = $time - $moment - 60; # Talk about one minute before midnight my @date = (localtime ($day))[5,4,3]; # Get yr., mon., day (yesterday) my $monthname = $lastmonth[$date[1]]; # Get last month's name "complain" is fictitious but doesn't have to be. I think this will do it. Now how to do it streamlined :=) Chuck Bacon -- crtb@capecod.net ABHOR SECRECY -- DEFEND PRIVACY On Mon, 3 Nov 1997, Eddie Fry wrote: > I'm trying to set up a cron to compress my RADIUS log files every month. > I wanted to start the cron at 11:59 on the last day of the month. But, > I can't figure out if cron will recognize a date of 31 in a 30 day month > or if there is another way to start the cron. Hmmm... I could run it at > 1 minute after midnight the next day, but how do I get "date" to return > the name of the previous month? > > Thanks for any help! I'm kinda new at the shellscript stuff. > > Eddie >