码迷,mamicode.com
首页 >  
搜索关键字:分发系统 expect    ( 1321个结果
shell 自动登录脚本
#!/bin/bash IP=`awk‘{print$1}‘/home/bash/mima.txt` foriin$IP do {port=`grep$i/home/bash/mima.txt|awk‘{print$2}‘` pawd=`grep$i/home/bash/mima.txt|awk‘{print$3}‘` expect<<EOF spawnssh-p$portroot@$i; expect{ "(yes/no)?"{send"yes\r"} "password:"{send"$pa..
分类:其他好文   时间:2014-09-28 18:43:36    阅读次数:133
shell 自动登录 上传 下载
通过在shell脚本中用expect实现远程scp文件:使用expect前,需要先安装两个rpm包:# rpm -ihv CentOS/expect-5.43.0-5.1.i386.rpm # rpm -ihv CentOS/expect-devel-5.43.0-5.1.i386.rpm 或者yu...
分类:其他好文   时间:2014-09-26 18:41:48    阅读次数:315
[python]运维辅助脚本
以下代码在python 2.6.6下测试通过 添加帐号并修改密码: (注:linux的expect命令也可以完成,交互式自动输入的功能) #!/usr/bin/env?python account?=?‘sl_t1‘ passwd=‘a1p2p3l4e5‘ cmd_useradd?=?‘userad...
分类:编程语言   时间:2014-09-24 14:43:28    阅读次数:208
C puzzles详解【16-20题】
第十六题The following is a small C program split across files. What do you expect the output to be, when both of them compiled together and run?File1.c .....
分类:其他好文   时间:2014-09-23 09:36:14    阅读次数:295
利用expect完成scp输入密码
#!/usr/bin/expectset timeout 60if {$argc != 3} { send "usage followed by src,dst,password" exit}set src [lindex $argv 0]set dst [lindex ...
分类:其他好文   时间:2014-09-22 18:46:22    阅读次数:186
shell---scp远程传输文件不需要手动输入密码
1.通过sshpass让ssh记住密码实现ssh自动登陆 (1)安装sshpass sudoapt-getinstallsshpass 或者 下载sshpass-1.05.tar.gz shell>tarxvfsshpass-1.05.tar.gz shell>cdsshpass-1.05 shell>make&&makeinstall (2)测试 shell>/usr/local/bin/sshpass-p密码ss..
分类:其他好文   时间:2014-09-17 18:53:53    阅读次数:225
Candy( 数学期望 )
math expect...
分类:其他好文   时间:2014-09-16 20:38:21    阅读次数:263
expect用法
1. [#!/usr/bin/expect] 这一行告诉操作系统脚本里的代码使用那一个shell来执行。这里的expect其实和linux下的bash、windows下的cmd是一类东西。 注意:这一行需要在脚本的第一行。 2. [set timeout 30] 基本上认识英文的都知道这是设置超时时...
分类:其他好文   时间:2014-09-15 22:42:39    阅读次数:664
linux expect自动登录ssh,ftp
expect是一种能够按照脚本内容里面设定的方式与交互式程序进行“会话”的程序。根据脚本内容,Expect可以知道程序会提示或反馈什么内容以及 什么是正确的应答。它是一种可以提供“分支和嵌套结构”来引导程序流程的解释型脚本语言。shell功能很强大,但是不能实现有交互功能的多机器之前的操作,例如ss...
分类:系统相关   时间:2014-09-12 18:55:33    阅读次数:375
expect 批量修改密码(无密码ssh登入就不要用这个了)
#!/bin/bashforipin`catiplist.txt`dopwd=`mkpasswd-l12-s0-C0`grep-q$ip/root/pwd.log&&passwd=$(grep$ip/root/pwd.log|cut-d:-f2)||passwd=123456expect-c"spawnsshroot@$ippasswdexpect{\"*yes/no*\"{send\"yes\r\";exp_continue}\"*password*\"{send\"$passwd\r\";..
分类:其他好文   时间:2014-09-11 19:33:52    阅读次数:237
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!