From 694bab211e9a598c09bae857693cef82a5728174 Mon Sep 17 00:00:00 2001 From: lework Date: Thu, 11 Jun 2020 14:45:32 +0800 Subject: [PATCH] add --- shell/getgcr.sh | 4 ++-- shell/ssh.sh | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 shell/ssh.sh diff --git a/shell/getgcr.sh b/shell/getgcr.sh index 1d98b8b..9d75eeb 100644 --- a/shell/getgcr.sh +++ b/shell/getgcr.sh @@ -18,7 +18,7 @@ ORANGE_PS3=$'\e[0;33m' WHITE='\033[0;37m' proxy=( - "gcr.lework.workers.dev" + "gcr.lework.workers.dev/google-containers" "registry.aliyuncs.com/google_containers" "gcrxio" ) @@ -84,7 +84,7 @@ function usage { echo echo echo "Example:" - echo " $0 gcr.io/google_containers/pause-amd64:3.1" + echo " $0 gcr.io/google-containers/pause-amd64:3.1" echo " $0 \"k8s.gcr.io/kube-{apiserver,controller-manager,proxy,scheduler}:v1.14.3\"" echo " $0 -i k8s.gcr.io/pause-amd64:3.1" echo " $0 -p registry.aliyuncs.com/google_containers -i k8s.gcr.io/pause-amd64:3.1" diff --git a/shell/ssh.sh b/shell/ssh.sh new file mode 100644 index 0000000..2774b6f --- /dev/null +++ b/shell/ssh.sh @@ -0,0 +1,18 @@ +SSH_PASSWORD="r00tme" +SSH_USER="root" +SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" + +type sshpass || (echo "sshpass is not installed" && exit 1) + +ssh_exec() { + node=$1 + shift + sshpass -p ${SSH_PASSWORD} ssh ${SSH_OPTIONS} ${SSH_USER}@${node} "$@" +} + +scp_exec() { + node=$1 + src=$2 + dst=$3 + sshpass -p ${SSH_PASSWORD} scp ${SSH_OPTIONS} ${2} ${SSH_USER}@${node}:${3} +} \ No newline at end of file