From owner-freebsd-isp Mon Nov 3 17:18:27 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id RAA20711 for isp-outgoing; Mon, 3 Nov 1997 17:18:27 -0800 (PST) (envelope-from owner-freebsd-isp) Received: from panda.hilink.com.au (panda.hilink.com.au [203.8.15.25]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id RAA20694 for ; Mon, 3 Nov 1997 17:18:22 -0800 (PST) (envelope-from danny@panda.hilink.com.au) Received: (from danny@localhost) by panda.hilink.com.au (8.8.5/8.8.5) id MAA27618; Tue, 4 Nov 1997 12:27:13 +1100 (EST) Date: Tue, 4 Nov 1997 12:27:12 +1100 (EST) From: "Daniel O'Callaghan" 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 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? Try this: --------- #!/bin/sh now=`date +%s` # then is the date 28 days prior to now. then=expr `$now - 2419200` lastmonth=`date -r $then +%h` echo $lastmonth --------- Note that this will give the current month on 29,30,31 of this month. Danny