Rotating Detail Files

Darren R Besler (dbesler@beehive.mb.ca)
Fri, 8 Nov 1996 00:59:35 -0600 (CST)

> From: Dean Forester <deanf@durham.net>
> Date: Thu, 7 Nov 1996 19:16:34 -0500 (EST)
> Subject: Rotating Detail Files
>
> Hi,
>
> How is the safest way to rotate the detail files? Do you have to HUP the
> raduisd? or should you pause it somehow while you move/rename the old
> file and touch a new one?
>
> FYI: I am running Raduis 1.16 on FreeBSD 2-2-960801-SNAP with 3 PM 2e-30s..
>
> Thanks In Advance,
>
> Dean Forester
> President,
> Durham.Net Inc.

I have thrown together the following script for shuffling the detail
files once a month - run it as often as required - it only keeps 6 files.
The script uses a file '/etc/raddb/radius.routers'
which just lists the hostnames of the routers for which detail files
are shuffled.

---

#!/bin/sh # # roll-detail - script to shuffle detail files # # Darren Besler (dbesler@beehive.mb.ca) - Aug 30, 1996 # Beehive Enterprises #

root=/usr/adm/radacct/

for router in `cat /etc/raddb/radius.routers` ; do cd $root$router if [ ! -f detail ]; then echo "$router: detail file not shuffled - does not exist" continue fi

if [ -f detail.5 ]; then if [ -f detail.6 ]; then echo "$router: detail.6 removed" rm detail.6 fi mv detail.5 detail.6 fi if [ -f detail.4 -a ! -f detail.5 ]; then mv detail.4 detail.5 fi if [ -f detail.3 -a ! -f detail.4 ]; then mv detail.3 detail.4 fi if [ -f detail.2 -a ! -f detail.3 ]; then mv detail.2 detail.3 fi if [ -f detail.1 -a ! -f detail.2 ]; then mv detail.1 detail.2 fi if [ -f detail.0 -a ! -f detail.1 ]; then mv detail.0 detail.1 fi

if [ ! -f detail.0 ]; then mv detail detail.0 echo "$router: detail file shuffled at `date`" else echo "$router: detail not shuffled - detail.0 exists" fi done

--
Darren R Besler                             PO Box 2207 Stn Main
Beehive Enterprises                         Winnipeg, Manitoba, Canada, R3C 3R5
Ph: 204-896-6103 Fax: 204-896-4168          Email:  dbesler@beehive.mb.ca