0

I currently have a log file which has no limit and I was hoping to be able to set up a cron job that would start writing to a new file so it doesn't get too big. Would that be possible? So it would keep the old one with a date and start a new one, with a 10MB size limit.

3

This problem is common enough that there's a whole program to do that, logrotate, which can also zip the old files, only keep the last X, and pretty much most things you could reasonably want to do with old logfiles.

  • I was actually just thinking of writing a script to rename the file and set a cron job to run it once a month – scott marriott May 29 '13 at 20:14
0

You are looking for logrotate. Hard not to find that with a short look at your favorite search engine.

  • 3
    It may be hard if you call it “casting up cron jobs” (I have no idea what that's supposed to mean). – Gilles May 30 '13 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.