From owner-freebsd-isp Mon Nov 3 20:35:35 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id UAA08336 for isp-outgoing; Mon, 3 Nov 1997 20:35:35 -0800 (PST) (envelope-from owner-freebsd-isp) Received: from gw.itfs.nsk.su (gw.itfs.nsk.su [193.124.36.33]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id UAA08315 for ; Mon, 3 Nov 1997 20:35:21 -0800 (PST) (envelope-from itfs!news!nnd%itfs.nsk.su@gw.itfs.nsk.su) Received: from itfs.UUCP (uucp@localhost) by gw.itfs.nsk.su (8.6.12/8.6.12) with UUCP id KAA00639 for isp@freebsd.org; Tue, 4 Nov 1997 10:35:09 +0600 Received: by itfs.nsk.su; Tue, 4 Nov 97 10:34:44 +0600 (NSK) Received: (from daemon@localhost) by news.itfs.nsk.su (8.7.5/8.6.12) id KAA05815; Tue, 4 Nov 1997 10:25:32 +0600 (NSK) From: nnd@itfs.nsk.su To: isp@freebsd.org Subject: Re: crons Date: 4 Nov 1997 04:25:30 GMT Message-ID: <63m83q$4uh@news.itfs.nsk.su> References: <199711032337.QAA11458@wicked.eaznet.com> Sender: owner-freebsd-isp@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Eddie Fry wrote: (with VERY LONG lines ;-) > 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? May be not very beautifyl but very simple solution: - start the cron job at 23:59 - ask and remember date (f.e. with /bin/sh : set `date '+%y %m %d'` year=$1 month=$2 day=$1) - sleep 60 sec - repeat step 2 above (ask the date) Now you can test if today is the first day of month or year. N.Dudorov