设置跳板机脚本

2023-05-19 17:29:48 浏览数 (1)

# 脚本如下

发送公钥到对应的机器

目录下创建ip

代码语言:javascript复制
192.168.100.32 | medicalinscore | ecsProd-201707141750
192.168.100.33 | medicalinscore | ecsProd-201707141751
192.168.100.197 | medicalinscore | ecsProd-medical-14-1
192.168.100.195 | medicalinscore | ecsProd-medical-14-2
192.168.100.226 | medicalinscore | ecsProd-medicalinscore-5
192.168.100.227 | medicalinscore | ecsProd-medicalinscore-6
192.168.100.225 | medicalinscore | ecsProd-medicalinscore-7
192.168.100.224 | medicalinscore | ecsProd-medicalinscore-8

192.168.100.31 | medicalinsprod | ecsProd-201707141752
192.168.100.30 | medicalinsprod | ecsProd-201707141753
192.168.100.196 | medicalinsprod | ecsProd-medical-14-3
192.168.100.198 | medicalinsprod | ecsProd-medical-14-4
192.168.100.229 | medicalinsprod | ecsProd-medicalinsprod-5
192.168.100.228 | medicalinsprod | ecsProd-medicalinsprod-6

192.168.100.75 | medicalinsmng | ecsProd-medicalinsmng-01
192.168.100.74 | medicalinsmng | ecsProd-medicalinsmng-02
192.168.100.208 | medicalinsmng-boot | ecsProd-medicalinsmng-boot-1
192.168.100.209 | medicalinsmng-boot | ecsProd-medicalinsmng-boot-2

设置跳板机脚本

代码语言:javascript复制
#!/bin/bash
echo "develop environment"
for i in `seq  $(cat ip | wc -l )`
do read line
echo $i"|" $line
done <ip
echo "please input the number for you choice machine"

read a
hostname=`sed -n ''$a'p' ip |awk '{ print $2 }'`
ip=`sed -n ''$a'p' ip |awk '{ print $1 }'`
echo "you while login this machine"${hostname}
ssh -l log $ip

0 人点赞