----------------------------
#!/usr/bin/bash
EXT=`date +%y%m`
cd /usr/local/var/log/radius/archive
mv radius.log $EXT.log
gzip -9 $EXT.log
-----------------------------
and if you use gnu date then you can run this thing right after midnight to get a true months log. the date string would then be
`date +%y%m -d yesterday`
--On Thursday, October 31, 2002 10:14 AM -0600 [EMAIL PROTECTED] wrote:
Hi, I just wrote a small Perl script... here it is... I am no Perl expert, but it gets the job done...# !/usr/bin/perl -w # This perl script should be put in the monthly cron rotation. # It will move the radius.log file to the archive folder and compress it use strict; my $day; my $month; my $date; my $time; my $timezone; my $year; `mv /usr/local/var/log/radius/radius.log /usr/local/var/log/radius/archive`; chdir "/usr/local/var/log/radius/archive"; `date > date.txt`; @ARGV = qw# /usr/local/var/log/radius/archive/date.txt #; while (<>) { chomp; my ($day, $month, $date, $time, $timezone, $year) = split; `mv /usr/local/var/log/radius/archive/radius.log /usr/local/var/log/radius/archive/$month$year.log`; `gzip $month$year.log`; `rm -r -f date.txt`; } Mark Capelle - CNE5, CNE4, A+ Network Administrator Paper Converting Machine CompanyMessage: 13 Date: Thu, 31 Oct 2002 10:41:33 -0500 From: Daniel Monjar <[EMAIL PROTECTED]> Subject: how to make radiusd restart its log files? To: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] I want to rotate my logs at the first of the month. I want to rename= the=20 log files and then have radiusd start writing to a new set. I was ho= ping=20 'kill -1' would make it write to a new radius.log but apparently not.= =20 Starting and stopping radiusd does it but that seems excessive. Any other way to do it? -- Daniel Monjar IS Manager, Technical Services bioM=E9rieux, Inc. Durham, NC US
-- Daniel Monjar IS Manager, Technical Services bioMérieux, Inc. Durham, NC US - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html