I'm currently writing a program that prints to a Zebra printer. Because my office doesn't have a zebra printer, we print to a linux VM running netcat with
nc -k -l -p 9100 | tee labels.txt so that we can view the output to the printer and verify correctness.
Unfortunately, this file gets pretty big and takes up a lot of space on the VM, especially because no one ever remembers to clear it.
tee seems to be a good option for writing to a file, but it isn't very featured in the way I'd desire. I'd like for the
label.txt to only grow to a certain size (say 20 MB), at which point it begins overwriting itself. Or perhaps renames
label.txt.1, allowing label.txt to grow and then overwriting
Is there any way to do this with
tee? Or should I be looking at another program?