Skip to content

Instantly share code, notes, and snippets.

@yuuki
Last active January 22, 2018 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuuki/5b8de59e89bf29b1af289e2a5e0a68cb to your computer and use it in GitHub Desktop.
Save yuuki/5b8de59e89bf29b1af289e2a5e0a68cb to your computer and use it in GitHub Desktop.
リモートコマンドラッパー
#!/bin/bash
set -e -o pipefail
DEPLOY_TO='operationserver'
CMD="$@"
if [ -z "${CMD}" ]; then
echo "CMD required" 1>&2
exit 1
fi
# -A は agent forwarding
# これを指定しないと、SSH_AUTH_SOCKを使って、オペレーションサーバのその先のホストに自分のユーザでログインできない
ssh -t -A ${DEPLOY_TO} "${CMD}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment