McKown, John 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}
I haven't got to the end of the thread yet, but mail and filtering might do: ( some processing) ) 2>&1 | mail -s "Program run on $(date +%Y-%m-%d)" [EMAIL PROTECTED] Get the mail delivered to a _directory_ (procmail might do it), and each report will be in its own, consecutively-numbered, file. You might also do something like this: set -C ( some processing ) 4>"report for $(date -d '1 days ago' +%Y-%m-%d) You can use more time fields, and you can get a pid in there using $$ - it will be the pid of the shell. -- Cheers John -- spambait [EMAIL PROTECTED] [EMAIL PROTECTED] Please do not reply off-list ---------------------------------------------------------------------- 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
