How can I limit the size of a log file written with >> to 200MB?
$ run_program >> myprogram.log
|
How can I limit the size of a log file written with
|
|||||||
|
|
If your application (ie. You can also use
|
|||||||||||
|
|
If your program doesn't need to write any OTHER files that would be larger than this limit, you can inform the kernel of this limit using
This will protect your system but it might be jaring for the program writing the file. As eyazici suggests, consider setting up |
||||
|
You can truncate the output with
|
|||||||||||||||
|
|
You may create a new filesystem image, mount it using loop device and put the log file on that filesystem:
You may also use |
|||
|
|
Since it is text, I would write a script in your favorite language and pipe it to that. Have it handle the file I/O (or keep it all in memory and then dump it on |
|||
|