From 77501543d0f9aa94dcc9a814f420c43e07f09611 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 29 Jan 2013 16:42:41 +0100 Subject: //services/bin/services: initial commit --- services/bin/services | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 services/bin/services (limited to 'services/bin') diff --git a/services/bin/services b/services/bin/services new file mode 100755 index 00000000..90d3f624 --- /dev/null +++ b/services/bin/services @@ -0,0 +1,18 @@ +#! /bin/sh +# usage: services [user@]hostname[:port] +set -euf + +user=services +hostname=${1-localhost} +port=1337 + +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 $user@$hostname -p $port -- cgit v1.2.3 From 2da96a69e9ab02db32cdafd194ef3e5f87ca71dc Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 29 Jan 2013 17:00:43 +0100 Subject: //services services: use $services_identity_file --- services/bin/services | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'services/bin') diff --git a/services/bin/services b/services/bin/services index 90d3f624..c142a363 100755 --- a/services/bin/services +++ b/services/bin/services @@ -1,11 +1,17 @@ #! /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` @@ -15,4 +21,4 @@ if echo $hostname | grep -q :; then hostname=`echo $hostname | cut -d: -f1` fi -ssh $user@$hostname -p $port +ssh $options $user@$hostname -p $port -- cgit v1.2.3 From 46ba0880900d5696024a615ac393d485f9adfaba Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 30 Jan 2013 01:48:27 +0100 Subject: //services/bin/services: ControlMaster=no --- services/bin/services | 2 ++ 1 file changed, 2 insertions(+) (limited to 'services/bin') diff --git a/services/bin/services b/services/bin/services index c142a363..957d197a 100755 --- a/services/bin/services +++ b/services/bin/services @@ -8,6 +8,8 @@ user=services hostname=${1-localhost} port=1337 +options="${options+$options }-o ControlMaster=no" + if test -n "${services_identity_file-}"; then options="${options+$options }-i $services_identity_file" fi -- cgit v1.2.3 From e282afbe09cc5d44b1b3329a9bc199a780be7300 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 30 Jan 2013 02:10:39 +0100 Subject: //services/bin/services: filter boring stderr --- services/bin/services | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'services/bin') diff --git a/services/bin/services b/services/bin/services index 957d197a..113480ee 100755 --- a/services/bin/services +++ b/services/bin/services @@ -23,4 +23,11 @@ if echo $hostname | grep -q :; then hostname=`echo $hostname | cut -d: -f1` fi +exec 3>&1 +{ ssh $options $user@$hostname -p $port +} 2>&1 1>&3 | sed ' + /^Connection to '$hostname' closed/d + /^Shared connection to '$hostname' closed/d +' +exec 3>&- -- cgit v1.2.3 From 6da636908a84d1703932a5806f03301b4043a258 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 30 Jan 2013 02:13:50 +0100 Subject: //services/bin/services: fix indentation --- services/bin/services | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'services/bin') diff --git a/services/bin/services b/services/bin/services index 113480ee..e854cbcb 100755 --- a/services/bin/services +++ b/services/bin/services @@ -25,7 +25,7 @@ fi exec 3>&1 { -ssh $options $user@$hostname -p $port + ssh $options $user@$hostname -p $port } 2>&1 1>&3 | sed ' /^Connection to '$hostname' closed/d /^Shared connection to '$hostname' closed/d -- cgit v1.2.3 From c5953301c721096e97ce7e83037f0da85ee4eaa7 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 8 Feb 2013 21:09:25 +0100 Subject: //services/bin/services: propagate ssh's exit code --- services/bin/services | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'services/bin') diff --git a/services/bin/services b/services/bin/services index e854cbcb..31aca200 100755 --- a/services/bin/services +++ b/services/bin/services @@ -25,9 +25,16 @@ fi exec 3>&1 { + set +e ssh $options $user@$hostname -p $port -} 2>&1 1>&3 | sed ' - /^Connection to '$hostname' closed/d - /^Shared connection to '$hostname' closed/d -' -exec 3>&- + echo "# Exit:$?" >&2 +} 2>&1 1>&3 | { + err="`cat`" + code=`echo "$err" | sed -n 's/^# Exit:\([0-9]\+\)/\1/p'` + echo "$err" | sed ' + /^Connection to '$hostname' closed/d + /^Shared connection to '$hostname' closed/d + /^# Exit:/d + ' >&2 + exit $code +} -- cgit v1.2.3 From 62b197ea0604cf9d785bf67eefcf7be00daa92b9 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 14 Feb 2013 13:06:07 +0100 Subject: create routine to update ssh_authorized_keys via ssh --- services/bin/update-services-pubkeys | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 services/bin/update-services-pubkeys (limited to 'services/bin') diff --git a/services/bin/update-services-pubkeys b/services/bin/update-services-pubkeys new file mode 100755 index 00000000..6a658607 --- /dev/null +++ b/services/bin/update-services-pubkeys @@ -0,0 +1,5 @@ +#!/bin/sh +KREBS_ROOT="${KREBS_ROOT:-/krebs}" +ssh $1 < Date: Thu, 14 Feb 2013 13:11:36 +0100 Subject: fix update-services-pubkeys --- services/bin/update-services-pubkeys | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'services/bin') diff --git a/services/bin/update-services-pubkeys b/services/bin/update-services-pubkeys index 6a658607..9936c402 100755 --- a/services/bin/update-services-pubkeys +++ b/services/bin/update-services-pubkeys @@ -1,5 +1,3 @@ #!/bin/sh KREBS_ROOT="${KREBS_ROOT:-/krebs}" -ssh $1 <