无法ssh免密,远程跳转多台机器安装脚本

ips=(10.1.1.1

10.1.1.2

)

password="yourpasswd"

for ip in ${ips[@]}

do

    echo $ip

    sshpass -p ${password} ssh -o BatchMode=no -o StrictHostKeyChecking=no -l root -p 22 $ip 'if [ `ls /etc/init.d/ilogtaild 2>/dev/null| wc -l` == 0 ]; then wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh;chmod 755 logtail.sh;./logtail.sh install auto; fi'

done

你可能感兴趣的:(无法ssh免密,远程跳转多台机器安装脚本)