Skip to content

Instantly share code, notes, and snippets.

View goliathuy's full-sized avatar

Mario goliathuy

  • Montevideo
View GitHub Profile
@goliathuy
goliathuy / multitail.sh
Created February 22, 2018 13:04 — forked from stantonk/multitail.sh
Unified tail -f of a log file across multiple hosts via ssh.
#!/bin/bash
# Example input and output (from the bash prompt):
# ./multitail.sh -H use@server -f /var/log/somelog.log
# ./multitail.sh -h "use@server use@server2 use@server3" -f "/var/log/somelogA.log /var/log/somelogB.log"
# ./multitail.sh --host "usu@server usu@server" --file "/var/log/logA.log"
# Based on https://gist.github.com/stantonk/5052027 and /usr/share/doc/util-linux/examples/getopt-parse.bash
# Note that we use `"$@"' to let each command-line parameter expand to a
# separate word. The quotes around `$@' are essential!