I use the following script to rename the detail file monthly: The
only negative to this script is it needs a C program I wrote years ago
- pfdate. It's just like date, but also accepts -p and -f options.
The -p option specifies the number of days in the past you want; -f
specifies the number of days in the future.
Example:
$ date ; pfdate -p 1
Wed Oct 23 15:14:33 EDT 1996
Tue Oct 22 15:14:33 EDT 1996
Pfdate also accepts the "+" formatting options that date does.
If you want it, let me know and I'll e-mail the source. I wrote it
originally on a 3B2/300 in 1985 or so and have ported it to a bunch of
other systems since then. It should compile pretty easily.
davek
Here's the shell script:
#!/bin/ksh
# $Id: $
########################################################################
#
# 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 |