I'm wondering how I can make a logfile that records the stdout of a certain program to roll over when it has reached 500KB for example using /bin/ash as the shell?
Thank you for any hints or suggestions!
migrated from stackoverflow.com Oct 30 '12 at 23:09
This question came from our site for professional and enthusiast programmers.
This does almost what you're asking for: http://stromberg.dnsalias.org/~strombrg/pypty/
It's a screen(1) reimplementation in Python.
It doesn't change files based on file size; instead it creates a new file each day, when invoked with -d for "dated files".
If you really need it based on size instead of time, you could probably modify it to do what you want.
You could probably also do a small bash script wrapped around dd bs=1024k count=1, for true size-based new file creation. I once did this for a program that backed up data to floppy disks or tapes of (mostly) fixed size (some tapes compress in the drive, so you can't always store the same number of bytes on them).