#!/usr/bin/expect
set WORK_PATH "/root"
set hostname "10.239.227.224"
spawn ssh root@$hostname
expect {
"yes/no"
{send "yes\r";}
#{send "yes\r"; exp_continue;}
"password:"
{exp_send "123456\r";}
"password:"
{exp_send "123456\r";}
}
puts "\n*****************************************************************************************************"
puts "\n LOGIN ${hostname} SUCCESSFULLY START TO EXCUTE COMMAND "
puts "\n*****************************************************************************************************"
expect "root@*" {send "cd ${WORK_PATH}\r"}
expect "root@*" {send "sh usbrelay.sh allon\r"}
expect "root@*" {send "exit\r"}