summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/find-active-nodes
diff options
context:
space:
mode:
authorroot <root@no_omo.retiolum>2013-03-07 16:17:43 +0100
committerroot <root@no_omo.retiolum>2013-03-07 16:17:43 +0100
commit96d7b3cb6232ea02bcec4c282dff94d9634a33b7 (patch)
tree981db30f172147203bdcf5c8a4a1f57aa4baad2f /retiolum/bin/find-active-nodes
parentef4eb3189363f5cd9a33b43693322a68d3142979 (diff)
emergency commit
Diffstat (limited to 'retiolum/bin/find-active-nodes')
-rwxr-xr-xretiolum/bin/find-active-nodes21
1 files changed, 21 insertions, 0 deletions
diff --git a/retiolum/bin/find-active-nodes b/retiolum/bin/find-active-nodes
new file mode 100755
index 00000000..2c316d0e
--- /dev/null
+++ b/retiolum/bin/find-active-nodes
@@ -0,0 +1,21 @@
+#! /bin/dash
+set -eu
+cd /etc/tinc/retiolum/hosts
+for name in `
+ grep '^[[:space:]]*Address[[:space:]]*=' * |
+ cut -d: -f1 | sort | uniq
+`; do
+ if eval "`sed -n '
+ s/[[:space:]]\+//g
+ s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p
+ ' $name`"; then
+ port=${Port-655}
+ for host in $Address; do
+ if nc -zw 2 $host $port 2>/dev/null; then
+ echo "$name [('$host', $port)]"
+ fi &
+ done
+ wait
+ fi &
+done
+wait