码迷,mamicode.com
首页 >  
搜索关键字:expect 构建分发文件系统    ( 1278个结果
1.7-自动登录expect脚本
第一部分:expect讲解expect可以让我们实现自动登录远程机器,并且可以实现自动远程执行命令。当然若是使用不带密码的密钥验证同样可以实现自动登录和自动远程执行命令。但当不能使用密钥验证的时候,我们就没有办法了。所以,这时候只要知道对方机器的账号和密码就可以通过exp..
分类:其他好文   时间:2016-03-09 07:10:25    阅读次数:139
1.9-expect脚本传递参数
我们还可以传递参数$argv0是第一个参数,以此类推#!/usr/bin/expectsetuser[lindex$argv0]参数的固定写法,第一个参数。sethost[lindex$argv1]setpasswd"123456"密码也可以引用变量setcm[lindex$argv2]cm是执行的命令spawnssh$user@$hostexpect{"yes/no"{send"yes\r"}"password:..
分类:其他好文   时间:2016-03-09 07:09:59    阅读次数:189
2.0-自动同步文件脚本
把远程机器的文件,同步到本台服务器#!/usr/bin/expectsetpasswd"hd792310"spawnrsync-avzProot@192.168.11.70:/tmp/12.txt/tmp/expect{"yes/no"{send"yes\r"}"password:"{send"$passwd\r"}}expecteof注意:两台服务器都必须安装rsync,否则会报错expecteof必须有,表示结束。..
分类:其他好文   时间:2016-03-09 07:09:29    阅读次数:176
2.2-构建简易文件分发系统
构建文件分发系统1.需求背景对于大公司而言,肯定时不时会有网站或者配置文件更新,而且使用的机器肯定也是好多台,少则几台,多则几十甚至上百台。所以,自动同步文件是至关重要的。2.实现思路首先要有一台模板机器,把要分发的文件准备好,然后只要使用expect脚本批量把需要..
分类:其他好文   时间:2016-03-09 07:08:32    阅读次数:157
1.8-自动登陆后执行命令
再来看一个登陆后,执行命令然后退出的脚本:#!/usr/bin/expectsetuser"root"setpasswd"123456"spawnssh$user@192.168.11.18expect{"yes/no"{send"yes\r";exp_continue}"password:"{send"$passwd\r"}}#以上和上一个脚本相同expect"]*"send"touch/tmp/12.txt\r"expect"]*"send"e..
分类:其他好文   时间:2016-03-09 07:08:19    阅读次数:131
python assert: 自动生成错误信息
用过python assert的朋友应该会经常碰到这样的疑惑,如: (a,b) = (1,'1') assert a==b # error: AssertionError 在代码调试的时候,很难直观的看出为什么错了,除非写成这样: assert 1=='1', "fact==expect, [fac
分类:编程语言   时间:2016-03-05 16:22:24    阅读次数:556
Lua Development Tools (LDT)
http://www.eclipse.org/ldt/ Lua Development Tools (LDT) is about providing Lua developers with an IDE providing the user experience developers expect
分类:其他好文   时间:2016-03-03 10:17:10    阅读次数:173
Unicode and .NET
http://csharpindepth.com/Articles/General/Unicode.aspx Scope of this page This is a big topic. Don't expect this page to do more than scratch the surf
分类:Web程序   时间:2016-03-01 18:41:07    阅读次数:203
Android development Notes-3(Activity, Intents, and Tasks, Service, Content provider)
-Android introduces a richer and more complex approach by supporting multiple application entry points. Android programs should expect the system to start them in different places, depending on where...
分类:移动开发   时间:2016-02-26 23:42:39    阅读次数:440
写了一段批量管理的bash小程序,利用了redhat 原生的expect,wget包组。
粘贴下readme:#myexpectV1.0released#authchentp0601@qq.com#envdescriptionmyexpectserverrequires:bashisneededofcource expectforanswerpassword vsftpdforclienttodownloadscriptsuploadfilesetc.myexpectclientrequires:ftpforupload wgetfordownload ..
分类:其他好文   时间:2016-02-24 09:59:02    阅读次数:129
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!