#!/usr/bin/expect-fsettimeout30spawnssh-p22-oServerAliveInterval=30-oServerAliveCountMax=10iwjw@30.0.0.23expect"Password:*"send"s8H30lk8w4l)2Ls@2k1d03\n"interact#!/bin/shssh-CPfN-oServerAliveInterval=30-oServerAliveCountMax=10-p22-L127.0.0.1:10000:10.24.29...
分类:
其他好文 时间:
2016-08-19 13:21:52
阅读次数:
122
前提条件服务器已经安装过tcl和expect, 若未安装:可以先执行 yum install tcl expect 进行安装 第一步、编写以下自动登录脚本login.sh ############################################## #!/usr/bin/expect ...
分类:
系统相关 时间:
2016-08-19 12:44:35
阅读次数:
202
之前看到一些大神说,作为一个运维,一个系统工程师的能力的其中一个很重要的检验标准就是他能够管理多少台机器,他能够自动化到什么程度,他能够多懒!---所以我也来班门弄斧了,所以就有了这篇文章。在现今高度发展的it社会,已经有很多的自动化管理程序了,例如Puppet,Salt,func,Capistra... ...
分类:
其他好文 时间:
2016-08-17 20:59:30
阅读次数:
250
模式的定义适配器模式(Adapter Pattern)定义如下:Convert the interface of a class into another interface clients expect.Adapter lets classes work together that couldn’t otherwise because of incompatible interface.将一个类的...
分类:
其他好文 时间:
2016-08-13 19:47:29
阅读次数:
122
使用expect实现自动登录的脚本,网上有很多,可是都没有一个明白的说明,初学者一般都是照抄、收藏。可是为什么要这么写却不知其然。本文用一个最短的例子说明脚本的原理。 脚本代码如下: 1 #!/usr/bin/expect 2 set timeout 30 3 spawn ssh -l userna ...
分类:
系统相关 时间:
2016-08-13 11:15:32
阅读次数:
223
exp文件的编写#!/usr/bin/expectsettimeout10setfname[lindex$argv0]setip[lindex$argv1]setdname[lindex$argv2]#spawnscp$fnameroot@$ip:$dnamespawnsshroot@$ipexpect{"*yes/no*"{send"yes\n";exp_continue}"*password*"{send"aixocm\n";exp_continue}}expect"*#*"{send"cd/t..
分类:
系统相关 时间:
2016-08-12 22:05:57
阅读次数:
226
CAS原语 CAS(compare and swap)是一组原语指令,用来实现多线程下的变量同步。 public final boolean compareAndSet(int expect, int update) { return unsafe.compareAndSwapInt(this, v ...
分类:
其他好文 时间:
2016-08-12 21:22:51
阅读次数:
194
Life is made up of small pleasures. 生活由各种细小的幸福构成。 Don't expect too much. I am not qualified to get more according to what I have done. I already have ...
分类:
其他好文 时间:
2016-08-06 00:32:16
阅读次数:
170
关于Tcl和Expect的语法,请参考Unix/Linux平台任务的自动化相关部分。QUOTE:例1:下面是一个telnet到指定的远程机器上自动执行命令的Expect脚本,该脚本运行时的输出如下:#/usr/bin/expectsample_login.exproot111111spawntelnet10.13.32.307001Trying10.13.32.30...Connectedt..
分类:
系统相关 时间:
2016-08-03 15:38:41
阅读次数:
262
51cto课程学习整理 http://edu.51cto.com/course/course_id-963.html #!/usr/bin/expect //非交互式 env 或者 set //查看用户环境变量 source 或者 . 执行脚本能把子shell变量传给父shell 脚本规范 1) # ...
分类:
系统相关 时间:
2016-07-21 14:54:27
阅读次数:
228