summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-07-03 14:21:37 +0200
committermakefu <github@syntax-fehler.de>2013-07-03 14:21:37 +0200
commit0bf5792cbea2fe9df939a5c2266d041391b05cd5 (patch)
tree6a9a940f819b43d3b0a1309b22f317dc30be5a48 /services
parent8822a1a8244ce4eb17b70269013738fe67238101 (diff)
show-services: change script params
Diffstat (limited to 'services')
-rwxr-xr-xservices/bin/show-services31
1 files changed, 31 insertions, 0 deletions
diff --git a/services/bin/show-services b/services/bin/show-services
new file mode 100755
index 00000000..e94eb7c8
--- /dev/null
+++ b/services/bin/show-services
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -euf
+cd $(dirname $(readlink -f $0))
+usage(){
+ cat <<EOF
+usage: $0 [pubkey-file] [bootstrap-file]
+ if pubkey-file is "" it will be skipped.
+
+ e.g.:
+ $0 "" ../path/to/other/bootstrap
+EOF
+
+}
+pubfile=${1:-}
+bootfile=${2:-../etc/services/bootstrap}
+
+for i in `cat $bootfile`; do
+ # retard uriparsing but good enough for our use case
+ netloc=${i##*//}
+ host=${netloc%%:*}
+ port=${netloc##*:}
+ [ "$port" == "$host" ] && port=1337
+ echo $netloc
+ pubarg="${pubfile:+-i $pubfile}"
+ printf ""
+ ssh ${pubarg} "services@$host" -p "$port" \
+ -o PasswordAuthentication=no 2>/dev/null||:
+ printf ""
+done
+