What I use is below. It uses a program I wrote years ago, pfdate,
that works like the unix date command with the addition that it
accepts two addtional options '-p' and '-f' -- past and future,
respectively. You can get pfdate.c from
ftp://ftp.muscle.net/pub/src/pfdate.c or I can e-mail it to you if you
want.
Good luck,
davek
#!/bin/ksh
# $Id: monthend,v 1.1 1997/03/01 04:38:11 root Exp $
########################################################################
#
# SYNOPSIS
# monthend
#
# DESCRIPTION
# Monthend processes the RADIUS detail file in preparation for
# monthly billing. It is expected to be run the first day of each
# month.
#
# 7/31/96 - Right now it just moves the detail file to a new name
#
# HISTORY
# Written 7/96 davek
#
########################################################################
export PATH=$PATH:/usr/local/bin
RADDIRS="/usr/adm/radacct/pm1"
NEWNAME=detail-$(pfdate -p 1 '+%y%m')
set -x
# Move the currently active detail file to detail-YYMM
for i in $RADDIRS
do
cd $i
mv detail $NEWNAME
done
set +x
-- | Dave Kennedy (davek@muscle.net) Voice: 770-368-1514 | | Multi-User Systems, Inc. Putting MUSCLE in Internet Access |