第一部分:expect讲解expect可以让我们实现自动登录远程机器,并且可以实现自动远程执行命令。当然若是使用不带密码的密钥验证同样可以实现自动登录和自动远程执行命令。但当不能使用密钥验证的时候,我们就没有办法了。所以,这时候只要知道对方机器的账号和密码就可以通过expect脚本实现登录和远程命令...
分类:
系统相关 时间:
2015-10-04 22:15:55
阅读次数:
348
shell尽管很强大。但是貌似无法完成交互式命令的操作,实例 ssh host 如果host而且该机没有加入信任。手动输入的时间需要password。这样的情况下可以使用expect支持。下面举个样例来说明expect的功能与使用:功能:对集群各机器运行同样指令 如 集群ip 为 :192.168....
分类:
其他好文 时间:
2015-09-26 14:41:47
阅读次数:
121
这个错误网上介绍比较少, 记录一下最近工作中遇到mongodb insert 时候报错, 现象:Thu Sep 24 09:19:15.011 ERROR: MessagingPort::call() wrong id got:367 expect:366 toSend op: 2004 respo...
分类:
数据库 时间:
2015-09-25 17:55:20
阅读次数:
213
转载请标明出处~#!/bin/bashSPATH=/tmp/index.js #测试路径/文件DPATH=/tmp/index.js_bak #目标路径/文件distribute_rsync () { ###分发函数expect -c " spawn rsync -aP $...
分类:
其他好文 时间:
2015-09-23 23:30:50
阅读次数:
503
Linux使用expect脚本实现远程机器自动登录...
分类:
系统相关 时间:
2015-09-23 10:35:56
阅读次数:
187
在内核代码中经常会看到unlikely和likely的踪影。他们实际上是定义在linux/compiler.h 中的两个宏。 #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(.....
分类:
其他好文 时间:
2015-09-22 18:44:27
阅读次数:
151
pyhton利用pexpect模块实现svnchekout一,安装pexpectpipinstallpexpect二,python脚本实现#!/usr/bin/envpython
#-*-coding:utf-8-*-
importpexpect
username=‘admin‘
password=‘passwd‘
svnurl=‘http://mysvnurl.com/svnproject‘
if__name__==‘__main__‘:
svn_link=‘svn..
分类:
编程语言 时间:
2015-09-22 14:46:36
阅读次数:
2915
一:适配器模式的定义 适配器模式:将一个类的接口转换成客户希望的另一个接口。适配器模式让那些接口不兼容的类可以一起工作 Adapter Pattern:Convert the interface of a class into another interface clients expect.A.....
分类:
其他好文 时间:
2015-09-14 00:27:37
阅读次数:
287
#!/usr/bin/envpython#-*-coding:utf-8-*-importpexpectimportsysssh=pexpect.spawn(‘sshroot@192.168.20.103‘)fout=file(‘sshlog.txt‘,‘w‘)ssh.logfile=foutssh.expect("root@192.168.20.103‘spassword:")ssh.sendline("yzg1314520")ssh.expect(‘#‘)ssh.sendline(‘ls/home‘)ss..
分类:
编程语言 时间:
2015-09-10 17:32:16
阅读次数:
160
expect是建立在tcl基础上的一个工具,它用来让一些需要交互的任务自动化地完成。因为expect是基于tcl的,所以需要你的系统中安装有tcl如何检查?[root@dev ~]# whereis tcltcl: /usr/lib/tcl8.4 /usr/share/tcl8.4如果看不到结果,请先安装tcl安装> 安装tcl解压tcl安装包后cd tcl8.4.11/unix/./config...
分类:
系统相关 时间:
2015-09-08 20:15:25
阅读次数:
241