From a2f5e9a48a051d0c8cd80e510655ccf1e5a4ba5c Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Mon, 21 Oct 2019 17:51:31 +0200 Subject: [PATCH] [ssh_tools] multissh: don't require pssh --- ssh_tools/multissh.sh | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/ssh_tools/multissh.sh b/ssh_tools/multissh.sh index 725026e..8ecc403 100755 --- a/ssh_tools/multissh.sh +++ b/ssh_tools/multissh.sh @@ -17,7 +17,6 @@ set -u # Exit codes readonly EXIT_SUCCESS=0 readonly EXIT_USAGE=127 -readonly EXIT_DEPENDENCY=4 readonly EXIT_HOSTS_LIST=6 print_usage() @@ -39,6 +38,23 @@ err() printf '%s\n' "$@" >&2 } +warn() +{ + printf 'Warning! ' >&2 + printf '%s\n' "$@" >&2 +} + +ssh_command() +{ + grep -v '^#' "$HOSTS" | while read -r host ; do + [ -z "$host" ] && continue + echo "Executing command on '$host'..." + # shellcheck disable=SC2086 + ssh ${LOGIN} "${host}" -- "$@"