[LUNI] scripting challenge - moving logs
Martin Maney
maney at pobox.com
Mon Nov 12 21:48:01 CST 2001
On Mon, Nov 12, 2001 at 08:19:38PM -0600, Lance Spitzner wrote:
> I want to create a cron job that takes the logs from the
> previous day and moves them to a different system. So if
> today is the 13th, it grabs the files from Nov_12 and moves
> them. How does one do this, determining the 'day before'
> challenge?
>
> Words of wisdom appreciated :)
<wisdom terseness="unixlike">
date(1)
</wisdom>
Pay attention to the -d option, eg.:
$ date
Mon Nov 12 21:45:26 CST 2001
$ date -d "-1 day"
Sun Nov 11 21:45:32 CST 2001
The rest is a little jiggery with the date format option and some trivial
shell scriptery. :-)
--
And in the end, reality always tends to hit theory hard
in the face when you least expect it. - Linus
More information about the luni
mailing list