Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing Text File Log

Status
Not open for further replies.

Sambo8

Programmer
May 10, 2005
78
NZ
Hi there,

I am not a unix scripter, however I have been given the task of amending the following so that it stores a daily log result:

mailx -s "`hostname`:$ORACLE_SID Commit Count for `date`" g.blah@blah.com,j.blah@blah.com </tmp/commitCount.log

currently this emails to two addresses and stores the a commitCount.log for today only this is overwritten the next time it runs.

Any help appreciated.

Many thanks,

Sam

 
A starting point:
cp /tmp/commitCount.log /path/to/dir/`date '+%Y-%m-%d'`.log

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for this;-)

I have now found out that this has to be done twice a day is there anyway of making the file store either datetime or date/number?

Many thanks,

Sam
 
man date

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
the returned file is alway one line. So would it be possible for it to append into the same file everytime it runs?
 
Hi

Sambo8 said:
would it be possible for it to append into the same file everytime it runs?
So you want the /tmp/commitCount.log file itself to not be overwrited ? That you have to discuss with the application which creates it. Or give us more details about it.

In meantime you can do this :
Code:
cat /tmp/commitCount.log >> bigbig.log

Feherke.
 
If you want a unique name also take a look at

> filename.$RANDOM.`date '+%Y-%m-%d'`

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top