初始提交
This commit is contained in:
19
py-deploy/bin/ssh
Normal file
19
py-deploy/bin/ssh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
BASEDIR=$(cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
|
||||
SSH_KEY=${BASEDIR}/$(ls ${BASEDIR} | egrep '.pem$' | head -n 1)
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
>&2 echo "Usage: $0 <hostname>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
host=$1
|
||||
user=$(whoami)
|
||||
for h in $(cat ${BASEDIR}/hosts | grep -v "^#" | egrep "\\s+${host}(\\s+.*)*$" | awk '{print $1}')
|
||||
do
|
||||
host=${h}
|
||||
break
|
||||
done
|
||||
|
||||
ssh -i ${SSH_KEY} ${host}
|
||||
Reference in New Issue
Block a user