Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1254641
  • 博文数量: 168
  • 博客积分: 3483
  • 博客等级: 中校
  • 技术积分: 1696
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-06 13:17
文章分类

全部博文(168)

文章存档

2015年(6)

2014年(9)

2013年(47)

2012年(11)

2011年(13)

2010年(18)

2009年(11)

2008年(42)

2007年(11)

分类: IT业界

2011-01-23 14:11:56

==========================================================================
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


阅读(1318) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~