[root@pc0003glpi_switch_ocs]#catssh3.py
#!/usr/bin/envpython
#-*-coding:utf-8-*-
importpexpect
importgetpass,os
defssh_command(user,host,password,command):
ssh_newkey=‘Areyousureyouwanttocontinueconnecting‘
child=pexpect.spawn(‘ssh-l%s%s%s‘%(user,host,com..
分类:
编程语言 时间:
2015-11-23 19:27:02
阅读次数:
229
1.expect方法#!/bin/bashcheckTrust(){ expect -c ' set timeout 2; spawn ssh $1 "expr 12345678 + 87654321" expect { ...
分类:
其他好文 时间:
2015-11-12 11:42:17
阅读次数:
323
#!/bin/bash
echo?"=====?build?and?upload?Linux?server?====="
gox?-osarch??"linux/amd64"
echo?"=====?build?finish?====="
/usr/bin/expect?<<-EOF
set?timeout?120
spawn?scp?xxx_linux...
分类:
其他好文 时间:
2015-11-04 15:01:32
阅读次数:
211
原文地址:http://www.nginx.cn/1934.htmlshell脚本需要交互的地方可以使用here文档是实现,但是有些命令却需要用户手动去就交互如passwd、scp对自动部署免去用户交互很痛苦,expect能很好的解决这类问题。expect的核心是spawn expect send ...
分类:
系统相关 时间:
2015-10-28 20:51:03
阅读次数:
276
在linux下进行一些操作时,有时需要与机器进行一些交互操作,比如切换账号时输入账号密码,传输文件时输入账号密码登陆远程机器等,但有时候这些动作需要在shell脚本中进行,这个时候就可以使用expect来进行自动的交互操作,从而避免需要人工干预引起的脚本中断执行。expect的核心命令:spawn ...
分类:
系统相关 时间:
2015-10-09 13:31:50
阅读次数:
177
下面,我们先简单的介绍一下几个常用的action的API。cc.repeatForever(action) 无限循环某个actioncc.sequence(action1,action2,...)顺序执行括号里面的actioncc.spawn(action1,action2,...)同时执行括号里面...
转载请标明出处~#!/bin/bashSPATH=/tmp/index.js #测试路径/文件DPATH=/tmp/index.js_bak #目标路径/文件distribute_rsync () { ###分发函数expect -c " spawn rsync -aP $...
分类:
其他好文 时间:
2015-09-23 23:30:50
阅读次数:
503
参考:http://github.tiankonguse.com/blog/2015/01/19/cgi-nginx-three/跟着做了一遍,然后根据记忆写的,不清楚有没错漏步骤,希望多多评论多多交流。。。搭建环境安装:nginx、spawn-fcgi、fastcgi、fcgiwrapnginxs...
分类:
其他好文 时间:
2015-09-23 21:05:50
阅读次数:
233
import pexpect,syschild = pexpect.spawn('/home/cf/elk/Summoner/Elk/logstash/test/bin/logstash -f /home/cf/elk/Summoner/Elk/logstash/test/conf.d', time...
分类:
编程语言 时间:
2015-09-16 17:55:06
阅读次数:
237
1、介绍pexpect通过pexpect我们可以实现对ssh,ftp,passwd,telnet等命令进行自动交互,不需要人工干预达到自动目的。2、pexpect的组件介绍2.1、spawn类作用:启动和控制子应用程序,其构造函数如下:classpexpect.spawn(command,args=[],timeout=30,maxread=2000,searchwindowsi..
分类:
其他好文 时间:
2015-09-13 20:06:03
阅读次数:
315