Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

migrated from stackoverflow.com Oct 30 '12 at 23:09

This question came from our site for professional and enthusiast programmers.

Is it a self written program? –  ott-- Oct 30 '12 at 21:25
no it is not but i can have a cronjob running to check the size of the log file... –  cerr Oct 30 '12 at 21:49

1 Answer 1

up vote 2 down vote accepted

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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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