0

Say I am writing to a log file:

services-manager &> lsm.log

is there a program I can use that will cap the log file at a certain size, maybe like 5mb?

so that might look like:

services-manager &> <(cap --mb=5 lsm.log)

using process substitution or whatever. What it means is if it starts getting too big, it will remove the lines at the beginning of the file.

  • Try using tee Here's an example: https://stackoverflow.com/questions/6708580/use-tee-or-equivalent-but-limit-max-file-size-or-rotate-to-new-file – stringy05 Oct 17 '18 at 02:14
  • I don't need to send stdout/stderr to anywhere but the file, so I don't think I need `tee` perse, I just need to write to a program that can delete old data from a file as it writes new data. –  Oct 17 '18 at 17:31

0 Answers0