Skip to content

Commit

Permalink
Merge branch 'master' into lildude/clean-old-nodes-on-restore
Browse files Browse the repository at this point in the history
  • Loading branch information
lildude committed May 14, 2018
2 parents 374ff58 + 7b3e798 commit 75f8209
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/ghe-backup
Expand Up @@ -101,7 +101,7 @@ cleanup () {
fi

# Cleanup SSH multiplexing
ghe-ssh --clean "$GHE_HOSTNAME"
ghe-ssh --clean
}

# Setup exit traps
Expand Down
2 changes: 1 addition & 1 deletion bin/ghe-restore
Expand Up @@ -73,7 +73,7 @@ cleanup () {
fi

# Cleanup SSH multiplexing
ghe-ssh --clean "$GHE_HOSTNAME"
ghe-ssh --clean
}

# Bring in the backup configuration
Expand Down
18 changes: 8 additions & 10 deletions share/github-backup-utils/ghe-ssh
Expand Up @@ -23,7 +23,7 @@ while true; do
;;
-c|--clean)
cleanup_mux=1
shift
break
;;
--)
echo "Error: illegal '--' in ssh invocation"
Expand All @@ -37,6 +37,11 @@ while true; do
esac
done

if [ -n "$cleanup_mux" ]; then
find $TMPDIR -name ".ghe-sshmux-*" -type s -exec ssh -O stop -S {} - \; >/dev/null 2>&1 || true
exit
fi

# Show usage with no host
[ -z "$host" ] && print_usage

Expand Down Expand Up @@ -77,12 +82,5 @@ fi
$GHE_VERBOSE_SSH && set -x

# Exec ssh command with modified host / port args and add nice to command.
if [ -z "$cleanup_mux" ]; then
# Exec ssh command with modified host / port args and add nice to command.
# shellcheck disable=SC2090 # We don't need the quote/backslashes respected
exec ssh -p $port $opts -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@"
elif [ -z "$GHE_DISABLE_SSH_MUX" ]; then
while ssh -O check -o ControlPath="$controlpath" "$GHE_HOSTNAME" > /dev/null 2>&1; do
ssh -O stop -o ControlPath="$controlpath" "$GHE_HOSTNAME" > /dev/null 2>&1
done
fi
# shellcheck disable=SC2090 # We don't need the quote/backslashes respected
exec ssh -p $port $opts -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@"

0 comments on commit 75f8209

Please sign in to comment.