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

2018-11-16  本文已影响0人  hbtszyt

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

上一篇下一篇

猜你喜欢

热点阅读