Code Monkey home page Code Monkey logo

nbudstee's Introduction

nbudstee: Non-Blocking Unix Domain Socket Tee

Tees Input to zero or more non-blocking Unix domain sockets, each of which can have zero or more connected readers.
Also copies to STDOUT, unless -n/--no-stdout is used.
Input defaults to STDIN

Usage:

nbudstee [options] uds1 uds2 ...

Where uds1 uds2 ... are zero or more filenames to use as Unix domain sockets.

Options:

  • -n, --no-stdout
    Do not copy input to STDOUT.
  • -b, --unlink-before
    First try to unlink any existing sockets. This will not try to unlink non-sockets.
  • -u, --unlink-after
    Try to unlink all sockets when done.
  • -m, --max-queue bytes
    Maximum amount of data to buffer for each connected reader (approximate).
    Accepts suffixes: k, M, G, for kilobytes, megabytes, gigabytes (multiples of 1024).
    Default: 64k.
    Above this limit new data for that socket reader will be discarded.
  • -i, --input file
    Read from file instead of STDIN.
  • -I, --input-reopen file
    Read from file instead of STDIN.
    When the end of input is reached, reopen from the beginning.
    This is primarily intended for FIFOs.

Use Case:

On demand logging, in particular in shell pipelines.

... | process | nbudstee -u uds1 | process | ...
... | process 2> >(nbudstee -n -u uds2) | ...

Any number of readers can read from each socket, on demand, without blocking the main pipeline, or requiring data to be dumped to a file.
This is useful for occasional debugging/sampling, or for inserting/removing tees without interrupting the main pipeline.

A possible command to read from a Unix domain socket is:

nc -U uds1

Notes:

  • No attempt is made to line-buffer or coalesce the input. A reader could receive a partial line when connecting/disconnecting if the input source is not line-buffered.
    If required line-buffer the input before piping it to nbudstee.
  • Writes to STDOUT are blocking.

URLs:

License:

GPLv2

nbudstee's People

Contributors

jgrennison avatar jonathanrennison avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.