3

GitHub - sl236/teetail: teetail - tee, but only the tail goes in the file

 1 year ago
source link: https://github.com/sl236/teetail
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

teetail

what?

teetail is like tee - it echoes its standard input to standard output and also to a file; but also like tail - no more than the number of bytes specified on the command line are placed in the file, and these are the tail of the dataset passing through teetail.

You have a pipeline moving gigabytes of output. You want to copy the data at some point in the pipeline to a file for debugging, like tee does. But there's way too much of it to store, so you want to limit the file size and just have the tool put the last part in there, like tail would. You could probably construct some kind of Rube Goldberg thing out of tee and tail and mkfifo. Or you could use teetail.

some pipeline | teetail -o log -c 1048576 | more pipeline

There are some configuration options, teetail with no arguments to see them.

compile

use your favourite C compiler, e.g.

gcc teetail.c -o teetail

install

place the teetail binary wherever locally built things go on your system, e.g.

sudo mv teetail /usr/local/bin


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK