aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-04-11 16:28:41 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-04-11 16:28:41 -0300
commit0d507b1d0d3137fb3e13a8c46de9e319373c5849 (patch)
tree3fbe6f7c271100ca45dfae5ca06ae0ac07f4e7b0 /share
parente8670f6e212a12d613744a66e20d39d54673eaaf (diff)
downloadhydra-0d507b1d0d3137fb3e13a8c46de9e319373c5849.tar.gz
hydra-0d507b1d0d3137fb3e13a8c46de9e319373c5849.tar.bz2
Adding ssh-config
Diffstat (limited to 'share')
-rw-r--r--share/hydra/ssh-config35
1 files changed, 35 insertions, 0 deletions
diff --git a/share/hydra/ssh-config b/share/hydra/ssh-config
new file mode 100644
index 0000000..92945f8
--- /dev/null
+++ b/share/hydra/ssh-config
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Thanks to http://paste.debian.net/93242/
+
+if [ $# -ne 1 ]; then
+ echo "Usage: ${0} nodes_dir"
+ exit 1
+fi
+
+NODESDIR=${1}
+
+if [ ! -d ${NODESDIR} ]; then
+ echo "Not a directory: ${NODESDIR}"
+ exit 1
+fi
+
+REGEXP1="\(nodo::vserver::instance\|context\)"
+REGEXP2="s/[^\"]*\"//"
+REGEXP3="s/\".*//"
+REGEXP4="s/[^']*'//"
+REGEXP5="s/'.*//"
+
+ishost=1
+
+while read l; do
+ if [ ! -z "${ishost}" ]; then
+ host=${l}
+ unset ishost
+ else
+ echo Host ${host}.sarava.org
+ echo Port 22`printf "%02d" "${l}"`
+ echo
+ ishost=1
+ fi
+done < <(grep -R "${REGEXP1}" ${NODESDIR} | sed -e "${REGEXP2}" -e "${REGEXP3}" \
+ -e "${REGEXP4}" -e "${REGEXP5}")