Operating System - HP-UX
1832596 Members
3066 Online
110043 Solutions
New Discussion

Re: Rename log file with yesterday date

 
Fuad_1
Regular Advisor

Rename log file with yesterday date

Hi,

Can you help please.

I want to run a job on daily basis, to rename a log file name with the date of yesterday date?!

Thanks.
Set goals, and work to achieve them
3 REPLIES 3
Robert-Jan Goossens
Honored Contributor

Re: Rename log file with yesterday date

Ralph Grothe
Honored Contributor

Re: Rename log file with yesterday date

Maybe a little awkward, but how about:

log_suffix=$(perl -MPOSIX=strftime -e 'print strftime("%Y%m%d",localtime(time-86400))')
Madness, thy name is system administration
Peter Godron
Honored Contributor

Re: Rename log file with yesterday date

Hi,
earlier threads with similar problem:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=139316
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=563529

I would write the filename you want to use tomorrow (i.e. todays date) into a file and then read that file contents tomorrow.

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.