一.用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
一、expect讲解expect可以让我们实现自动登录远程机器,并且可以实现自动远程执行命令。当然若是使用不带密码的密钥验证同样可以实现自动登录和自动远程执行命令。但当不能使用密钥验证的时候,我们就没有办法了。所以,这时候只要知道对方机器的账号和密码就可以通过expect脚..
分类:
系统相关 时间:
2015-11-12 18:20:43
阅读次数:
436
1.expect方法#!/bin/bashcheckTrust(){ expect -c ' set timeout 2; spawn ssh $1 "expr 12345678 + 87654321" expect { ...
分类:
其他好文 时间:
2015-11-12 11:42:17
阅读次数:
323
1.使用ssh登录用户为weblogic的脚本,arg 0为主机地址,argv 1 为密码#!/usr/bin/expect -fset ip [lindex $argv 0]set password [lindex $argv 1]set name weblogicset passwd weblo...
分类:
其他好文 时间:
2015-11-10 13:47:27
阅读次数:
175
一、expect简介expect是一种能够按照脚本内容里面设定的方式与交互式程序进行“会话”的程序。根据脚本内容,Expect可以知道程序会提示或反馈什么内容以及什么是正确的应答。它是一种可以提供“分支和嵌套结构”来引导程序流程的解释型脚本语言。shell功能很强大,但是不能实现..
分类:
其他好文 时间:
2015-11-05 19:00:53
阅读次数:
332