==========================================================================
cat _qubao.expect
set ip [lindex $argv 0]
set dir [lindex $argv 1]
set timeout 5
set ftpip 192.168.101.101
set ftplogstat "NG"
spawn telnet "$ip"
expect "login:"
send "root\n"
expect "assword:"
send "****\n"
expect "> "
send "cd /home/test; ls -l\n"
expect "> "
send "ftp -i -n -v $ftpip \n"
while { $ftplogstat != "OK" } {
expect {
"ready for new user" { set ftplogstat "OK" }
timeout {
send "open $ftpip \n"
}
}
}
expect "ftp> "
send "user k k\n"
expect "ftp> "
send "bin\n"
expect "ftp> "
send "cd $dir \n"
expect "ftp> "
send "get $dir.kk \n" # 不能用 get *.suffix; 只有mget才可以用通配符 mget *.kk
expect "ftp> "
send "by\n"
expect "> "
send "\[ $? != 0 \] && sleep 10000\n"
expect "> "
send "sleep 10 \n"
expect "> "
send "exit \n"
cat kkk.bat
@echo
D:
chdir D:\cygwin\bin
expect -f /cygdrive/e/_qubao.expect %1 %2
pause
EXIT
start e:\kkk.bat 192.168.3.11 pkgdir
cygwin环境下,直接将_qubao.expect和下面qubao.bat放在一起,实现多窗口并发执行登录ftp操作
cat qubao.bat
start expect -f _qubao.expect 192.168.3.11 %1
start expect -f _qubao.expect 192.168.3.12 %1
start expect -f _qubao.expect 192.168.3.13 %1
start expect -f _qubao.expect 192.168.3.14 %1
start expect -f _qubao.expect 192.168.3.15 %1
==============================================================================
磁盘性能优化:
sdparm -s WCE=1,RCD=0 -S /dev/sdb
详见:
http://blog.csdn.net/liuben/archive/2010/04/13/5482167.aspx
man sdparm
阅读(1361) | 评论(0) | 转发(0) |