Linux on 390 Port <[email protected]> wrote on 07/17/2007 12:05:55
PM:
> 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
John,
Depending on how robust this needs to be... The date command can be
passed a myriad of format strings. I.e., if you wanted time in seconds
since 1970 and the 4 digit year:
[EMAIL PROTECTED]:date "+%s.%Y"
1184672412.2007
Thanks,
Ray Higgs
System z FCP Development
Bld. 706, B24
2455 South Road
Poughkeepsie, NY 12601
(845) 435-8666, T/L 295-8666
[EMAIL PROTECTED]
----------------------------------------------------------------------
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