Script to automatically open Cluster SSH to all machines in network
authorHarvie <tomas@mudrunka.cz>
Mon, 24 May 2010 21:46:49 +0000 (23:46 +0200)
committerHarvie <tomas@mudrunka.cz>
Wed, 26 May 2010 21:45:12 +0000 (23:45 +0200)
bash/clusterssh-scan.sh [new file with mode: 0755]

diff --git a/bash/clusterssh-scan.sh b/bash/clusterssh-scan.sh
new file mode 100755 (executable)
index 0000000..c28e275
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+scan_for_ssh() {
+       for i in $( seq 158 255 ); do
+               # echo 1 "$1"."$i" 22;
+               nc -z -w 1 "$1"."$i" 22;
+               if [ "$?" = 0 ]; then
+                       echo -n "$1.$i ";
+               fi;
+       done;
+       echo;
+}
+
+get_ssh_logins() {
+       for i in $( scan_for_ssh "$2" ); do
+               echo -n "$1"@"$i ";
+       done;
+       echo;
+}
+
+get_ip_range() {
+       for i in $( seq 158 255 ); do
+               echo -n "$1.$i ";
+       done;
+       echo;
+}
+
+#cssh $( get_ssh_logins root 192.168.2 )
+
+cssh -T "Klub SSPS" root@192.168.2.161
This page took 0.114198 seconds and 4 git commands to generate.