summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/find-active-nodes
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-04-04 10:14:27 +0200
committermakefu <github@syntax-fehler.de>2013-04-04 10:14:27 +0200
commit5266540d4c21494adbac3f25f982f2bf32390734 (patch)
treee0532270da21fbb368c98347c0506ed850d86e58 /retiolum/bin/find-active-nodes
parent7fa8fb85b072f612adb322f8a02617e1bd737020 (diff)
parentc57300f04afe66c596b6ea658457aae260ab323e (diff)
Merge branch 'master' of github.com:krebscode/painload
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