【shell】ssh登录到其他主机并切换root运行查询命令
/usr/bin/expect << EOF
spawn /usr/bin/ssh -t -p 22088 -oStrictHostKeyChecking=no sms@${ip} "su "
expect {
"*assword*" { send "Eastcom@!@#\n" }
}
expect {
"Password:" { send "Eastcomnfv@2018\n" }
}
expect "*]#"
send "sh /utxt/soft/ssftp/ssftp_restart.sh \r"
expect "*]#"
send "exit\r"
expect eof
EOF