#!/bin/bash
#. /opt/jialuyan/1.sh
#test
function test(){
expect << EOF
set timeout 10
spawn ssh omm@10.100.203.44
expect {
"(yes/no)" {send "yes\r";exp_continue}
"password:" {send "Bigdata123@omm\r"}
}
expect "omm@*" {send "sh /opt/gcyyunwei/gcyyunwei/elksqllongtime.sh\r"}
expect "omm@*" {send "exit\r"}
expect eof
EOF
}
test
能够远程登录,执行脚本