Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

The Rig

The Rig pipes standard input to multiple programs running in parallel and presents the aggregated output in different ways.


Say, for example, that you want to have a look at how much space is being wasted by logs on some remote hosts you manage.

Create a “preset.yaml” file.

label: "du {{.host}}:{{.path}}"
command: ["ssh", "{{.host}}", "du", "-sh", "{{.path}}" ]
  - { host: "", path: /var/log }
  - { host: "", path: /var/log }

If a preset file defines one or more argument dictionaries, the command line and the label will be treated as a Go templates, and one instance of the program is run for each dictionary after placeholders have been replaced with the actual values.

Running the Rig

# Report
$ rig report *.yaml

# Stream
$ rig stream *.yaml

# In a pipeline
$ echo 'SELECT * FROM some_table' | rig report remote-mysql-1.yaml remote-mysql-2.yaml

The report subcommand buffers each programs output until the program finishes, ensuring each program’s standard output and error are printed together.

The stream subcommand prints each programs output as it comes in, without any buffering or ordering, and is more suitable for running programs like tail -f.

The wallboard subcommand repeatedly runs all programs every --interval seconds and present the time since the program’s last change from an OK status (when exit code is 0) to a FAIL status (when exit status > 0) – and hopefully back to OK –, along with the last line of the program’s stderr or stdout, if any.

Order of execution in stream and report mode

When the Rig receives multiple preset files as positional arguments, each preset file is treated as a “queue” of programs, and:

  • all queues are started immediately, and in parallel.
  • programs from the same preset file, as a consequence, are run one after another (regardless of the previous program’s exit status).

The --fearless option causes all programs to be started in parallel.

You can’t perform that action at this time.