Actually, Unix tends to to this kind of backward. Create the file with
whatever standard name you'd like (application.log, userlog.list,
appmessages...). Then create a file in /etc/logrotate.d (from a SuSE point
of view) describing the file, how big you want it to get, when you want it
rotated, how many to keep, etc.
Logrotate will then rename the file as necessary and create a new one for
the application to write to. Or, if the app won't stomach that, it will copy
out the data from the file, and then truncate it so that the application can
keep writing to the same file.
--
.~. Robert P. Nix Mayo Foundation
/V\ RO-OE-5-55 200 First Street SW
/( )\ 507-284-0844 Rochester, MN 55905
^^-^^ -----
"In theory, theory and practice are the same, but
in practice, theory and practice are different."
On 7/17/07 11:05 AM, "McKown, John" <[EMAIL PROTECTED]> wrote:
> I'm looking for a __simple__ way to approach this. I would like to
> create a "log" type file from an application. Instead of logging to a
> specific file name each time, I would like to log to a "base name" which
> then appends an ever increasing number on the end. This is like a GDG in
> z/OS, where I just specify DSN=SOME.NAME(+1) and the system generates
> the next GDG number in sequence. So far, the best that I've come up with
> is something like:
>
> #!/bin/sh
> cd /logging/sub/directory
> export BASENAME=base.name
> NEXT=$(ls -l ${BASENAME}.* | awk -F '.' '{print $NF}' | sort -nr | head
> -1)
> if [ -z $NEXT ]; then NEXT=0;fi
> NEXT=$((1+${NEXT}))
> export GDG=${BASEENAME}.${NEXT}
> program --logname=${GDG}
>
>
> --
> John McKown
> Senior Systems Programmer
> HealthMarkets
> Keeping the Promise of Affordable Coverage
> Administrative Services Group
> Information Technology
>
> The information contained in this e-mail message may be privileged
> and/or confidential. It is for intended addressee(s) only. If you are
> not the intended recipient, you are hereby notified that any disclosure,
> reproduction, distribution or other use of this communication is
> strictly prohibited and could, in certain circumstances, be a criminal
> offense. If you have received this e-mail in error, please notify the
> sender by reply and delete this message without copying or disclosing
> it.
>
> ----------------------------------------------------------------------
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390