买了个ssh,淘宝上到处都是,就不说具体哪家了。价格还可以,一个月3块,先来了一个月尝尝。
速度还行,就是有一点比较讨厌,没法保持连接,一段时间idle之后就被断开了,尝试设了一些参数,还是不行,还是写个脚本来干。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/usr/bin/expect -f set timeout 30 spawn ssh wall match_max 100000 expect -re ".*password:.*" send -- "xxxxxx\r" send -- "\r\r\r\r" expect timeout for {} 1 {} { send "ls\r" expect timeout } exit |
其实很简单,就是登录之后每隔30秒就ls一下。估计这样就行了。