Want to recreate my log files on server

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
djdon11
Forum Commoner
Posts: 90
Joined: Wed Jun 20, 2007 5:03 pm

Want to recreate my log files on server

Post by djdon11 »

Hello All,

I have certain cron running on my server and the script runs with these cron actually creates some log files on server with certain data. As the cron goes on these log files goes to heavy. Now what i want that after having a certain amount of data the log file should recreated instead of updating the same. Do any buddy having such idea to recreate the log files automatically on the server?

Thanks in advance
prensil
Forum Newbie
Posts: 15
Joined: Tue Apr 26, 2011 8:38 am
Location: Ahmedabad
Contact:

Re: Want to recreate my log files on server

Post by prensil »

You can run another cron to move the log file with some file size condition. Then you can run touch command to create the exact file with same name at the original location.
Let me know if this will work.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Want to recreate my log files on server

Post by pickle »

Look into the log rotation daemon. It's purpose is to do exactly what you want.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply