expect远程获取服务器性能数据

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了expect远程获取服务器性能数据相关的知识,希望对你有一定的参考价值。

#!/usr/bin/expect

set timeout 5

spawn ssh [email protected] "df -Th >>/root/disk.txt"


expect {


"*yes/no" { send "yes\r"; exp_continue}


"*password:" { send "vision\r" }


}



spawn scp 192.168.3.8:/root/disk.txt /root/


expect "*password*"

send "vision\r"


expect eof


本文出自 “小V运维之路” 博客,请务必保留此出处http://victor2016.blog.51cto.com/6768693/1915058

以上是关于expect远程获取服务器性能数据的主要内容,如果未能解决你的问题,请参考以下文章