Skip to content
/ rig Public

The Rig executes programs and joins the output in a single stream.

License

Notifications You must be signed in to change notification settings

marzocchi/rig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Rig

The Rig pipes STDIN to some programs listed in a Rigfile and presents their STDOUT and STDERR in a single stream.

Usage

# report mode, for programs that produce document-like output
./rig.py report Rigfile

# stream mode, for programs that produce a continuos stream of text,
# like `tail` (use CTRL-C to stop)
./rig.py stream Rigfile

A Rigfile is a list of programs to execute, one per line and prefixed by a label.

cat > Rigfile <<EOF
host-1 psql -h host-1.example.invalid
host-2 psql -h host-2.example.invalid
EOF

echo 'SELECT * FROM some_table;' | rig.py report Rigfile

A file whose name ends with .sh is executed, and the output is used instead of the file contents, eg.:

cat > Rigfile.sh <<EOF
#!/bin/sh
kubectl get pods -o name | sed 's:^pod/::' | while read -r POD
do
    echo "$POD" kubectl exec -i "$POD" bash
done
EOF

echo 'ls -l' | ./rig.py report Rigfile

About

The Rig executes programs and joins the output in a single stream.

Topics

Resources

License

Stars

Watchers

Forks

Languages