一、Expect简介在远程服务器执行某项任务,这是最正常不过了,如何有效自动的执行呢?这里介绍自动交互脚本expect的使用。Expect是一个简单的工具语言,功能就是进行自动化的人机交互。它的作者对Expect的定义:是一个实现自动交互功能的软件套件(asoftwaresuiteforautomating..
分类:
其他好文 时间:
2016-01-12 19:44:39
阅读次数:
156
a) spawn: spawn命令是Expect的初始命令,它用于启动一个进程,之后所有expect操作都在这个进程中进行,如果没有spawn语句,整个expect就无法再进行下去了,使用方法就像下面这样: spawnssh root@192.168.0.1在spawn命令后面,直接加上要启动的进程...
分类:
其他好文 时间:
2015-12-29 19:08:50
阅读次数:
267
#!/bin/bashauto_ssh_key(){expect-c"settimeout-1;spawnssh-copy-id-i$path/.ssh/id_rsa$1;expect{*yes/no*{send--yes\rexpect*assword*send--$2\r;expect{*denied*{exit2;}eof}}*assword*{send--$2\r;expect{*denied*{exit2;}eof}}eof}"}echo‘--------------------Directions..
分类:
其他好文 时间:
2015-12-12 08:23:26
阅读次数:
174
http://blog.csdn.net/tantexian/article/details/45887857http://stackoverflow.com/questions/19403360/how-to-use-expect-to-copy-a-public-key-to-a-hostUnd...
分类:
其他好文 时间:
2015-12-10 13:26:10
阅读次数:
350
一.用expect实现交互式输入#!/usr/bin/expect-fsetLUKS_passphrasexxxx123setVerify_passphrasexxxx123spawncryptsetupluksFormat/dev/vdb1expect"Areyousure?(Typeuppercaseyes):"settimeout5send"YES\r"expect"EnterLUKSpassphrase:"settimeout5send"$LUKS_passphrase\r"expe..
分类:
其他好文 时间:
2015-12-09 19:52:29
阅读次数:
206
一 什么是expect 1 Expect is a tool for automating interactive applications such as telnet, ftp, 2 passwd, fsck, rlogin, tip, etc. Expect really make...
分类:
其他好文 时间:
2015-12-06 19:14:06
阅读次数:
333
Linux expect 使用简介一.登陆到远程主机脚本代码如下:###############################################!/usr/bin/expectset timeout 30spawn ssh -l username hostipexpect { "y...
分类:
系统相关 时间:
2015-12-04 12:24:24
阅读次数:
145
huawei用expect来获取AC里面WLAN的MAC地址名单,运行脚本,信息会输出到屏幕1get.switch.wlan.grep.mac.sh用正则表达式过滤MAC地址,保存纯MAC到文件中2.exception.py用来把从AC获取的MAC与GLPI的MAC进行比较,把不在GLPI里面的MAC输出到文件安装Python-mysql库
[root@pc000311..
分类:
编程语言 时间:
2015-11-24 18:48:47
阅读次数:
293
【问题描述】交易的expect flow不能从pending状态更新到SAPR状态,可能是pre-settlement server的问题。【解决方法】该问题是因为目前系统内堆积了比较多的待处理的消息,约40万的样子, 且系统环境比较慢, 所以新录入的交易的EXPFLOW无法正常编程SAPR, 通过...
分类:
其他好文 时间:
2015-11-24 12:32:04
阅读次数:
129
[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