#!/usr/bin/expect -f
#=====================================================#
# monitor.exp #
# written by dongxiaobing #
# 2014.05.22 #
# 具有相同的用户名和密码的多台服务器自动巡检 #
# monitor.sh为智能巡检脚本 #
# #
# #
#======================================================#
foreach ip {
192.168.1.108
192.168.1.109
} {
spawn ssh idnms@$ip
expect {
"*yes/no" {send "yes\r";exp_continue}
"*password:" {send "kindsoft\r"}
}
expect "$*"
send "./monitor.sh\r"
send "exit\r"
expect eof
}
#=====================================================#
# monitor.exp #
# written by dongxiaobing #
# 2014.05.22 #
# 具有相同的用户名和密码的多台服务器自动巡检 #
# monitor.sh为智能巡检脚本 #
# #
# #
#======================================================#
foreach ip {
192.168.1.108
192.168.1.109
} {
spawn ssh idnms@$ip
expect {
"*yes/no" {send "yes\r";exp_continue}
"*password:" {send "kindsoft\r"}
}
expect "$*"
send "./monitor.sh\r"
send "exit\r"
expect eof
}