Click here to Skip to main content
15,906,081 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Want to Write a script to rotate log file of my application on the daily basis..

like this..,

#!/bin/ksh
export TERM=xterm
cp -f /data/logs/nohup.log /data/logs/nohup.log.`date +%y%m%d%k%M%S`
> /data/logs/nohup.log


which will run automatically at the end of the day...
Posted
Updated 2-Feb-11 1:08am
v3
Comments
Richard MacCutchan 2-Feb-11 6:54am    
OK, so what is your question?

1 solution

Install the logrotate[^] package instead of trying to reinvent it from scratch.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900