summaryrefslogtreecommitdiffstats
path: root/retiolum/bin
diff options
context:
space:
mode:
authorYour Name <you@example.com>2013-03-15 06:02:38 -0400
committerYour Name <you@example.com>2013-03-15 06:02:38 -0400
commit6f7e5064dc0d9eee24a9cfb42825913af673aef9 (patch)
treeb7ecc9b1e424bd76f626fbbe50e3a132dbba240a /retiolum/bin
parente1047af73a37bcb0a2395ab00e06997eb6a7b61a (diff)
parentcc1088454b5e9f9e31436a5de313b11030b94e34 (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'retiolum/bin')
-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