expect实现多台服务器自动巡检
2014-05-23 09:37
218 查看
#!/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
}
相关文章推荐
- 用expect实现ssh自动登录服务器并进行批量管理的实现方法
- 【转】shell脚本实现多台服务器自动巡检--可参考学习
- 用expect实现的自动登录到多台服务器的shell脚本
- 【Java】实现对服务器的自动巡检邮件通知
- 用expect实现ssh自动登录对服务器进行批量管理
- java实现对服务器的自动巡检邮件通知
- iTerm2 结合 Linux expect 实现 ssh 自动登陆, 通过跳板机登录服务器内网功能
- shell+expect实现多台服务器自动运行脚本。
- java实现对服务器的自动巡检邮件通知
- shell脚本实现多台服务器自动巡检
- 用expect实现ssh自动登录服务器并进行批量管理的实现方法
- 利用expect实现自动登录服务器
- expect实现文件自动传输初级,后面多台服务器可以结合NFS批量分发。
- shell脚本实现多台服务器自动巡检--可参考学习
- 用expect实现ssh自动登录对服务器进行批量管理
- 用expect实现ssh自动登录对服务器进行批量管理
- 用了一天的时间,linux下expect实现ssh自动登录服务器记,鄙视下网上各种抄来抄去残段子
- java实现对服务器的自动巡检邮件通知
- 用expect实现的自动登录到多台服务器的shell脚本
- 用expect实现ssh自动登录对服务器进行批量管理