summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <root@pigstarter.de>2013-01-29 16:18:30 +0000
committermakefu <root@pigstarter.de>2013-01-29 16:18:30 +0000
commit3a559eee66f8bd5efac8b7df39b40c6e89a769ad (patch)
tree9edbadffce39c2afa61188f8879c416b4a1d0c8b
parentd221dc6c4a959edbbab7dde34020d9ce46897b8e (diff)
parent2da96a69e9ab02db32cdafd194ef3e5f87ca71dc (diff)
Merge branch 'master' of https://github.com/krebscode/painload
-rwxr-xr-xservices/bin/services24
1 files changed, 24 insertions, 0 deletions
diff --git a/services/bin/services b/services/bin/services
new file mode 100755
index 00000000..c142a363
--- /dev/null
+++ b/services/bin/services
@@ -0,0 +1,24 @@
+#! /bin/sh
+# usage: services [user@]hostname[:port]
+# environment:
+# services_identity_file path to ssh(1) identity_file
+set -euf
+
+user=services
+hostname=${1-localhost}
+port=1337
+
+if test -n "${services_identity_file-}"; then
+ options="${options+$options }-i $services_identity_file"
+fi
+
+if echo $hostname | grep -q @; then
+ user=`echo $hostname | cut -d@ -f1`
+ hostname=`echo $hostname | cut -d@ -f2`
+fi
+if echo $hostname | grep -q :; then
+ port=`echo $hostname | cut -d: -f2`
+ hostname=`echo $hostname | cut -d: -f1`
+fi
+
+ssh $options $user@$hostname -p $port