#!/usr/bin/expect -f
set timeout 10
set name [lindex $argv 0]
set pwd [lindex $argv 1]
set ip [lindex $argv 2]
spawn ssh -l $name $ip
expect "password:"
send "$pwd\r"
interact...
分类:
其他好文 时间:
2015-04-27 11:22:01
阅读次数:
110
数据库相关操作
1、创建数据库
create database databasename
成功返回Query OK
失败返回Error 1007
2、查看所有的数据库
show databases
注意:是databases,复数
3、选择数据库
use databasename
返回是Database changed 知道这个在使用expect时有用
失败返回Err...
分类:
数据库 时间:
2015-04-26 10:53:48
阅读次数:
215
完成此脚本,主要是为了将本地服务器上的文件同步到腾讯云跳板机,然后再中转上传到腾讯云服务器。当然这也只是初步的方案。#vim/data/scripts/put_file.exp#!/usr/bin/expect
########################################################################
#pushlocalserver’sf..
分类:
其他好文 时间:
2015-04-25 16:49:00
阅读次数:
189
适配器模式英文原文是:Convert the interface of a class into anther interface clients expect. Adapter lets classes work together that couldni`t otherwise because of incompatible interface. 意思是将一个类的接口变化成客户端所期待的另一种...
分类:
其他好文 时间:
2015-04-23 11:07:25
阅读次数:
142
在codewars网站做题,做到一下一道题。var add = function (a, b) { return a + b; };var lazy_sum = make_lazy(add, 2, 3);Test.expect(lazy_sum() === 5, 'Evaluates the exp...
分类:
其他好文 时间:
2015-04-22 00:22:52
阅读次数:
113
一:先来看一下效果:二:实现的步骤(在机器172.16.0.1(centos系统)执行下列命令,就可以远程无密码登录172.16.0.2):1:ssh-keygen-trsa(回车回车)2:ssh-copy-id-i/root/.ssh/id_rsa.pubroot@172.16.0.2(172.16.0.2换成ssh-server的ip即可)三:通过expect或者<<EOF直接输入给..
分类:
其他好文 时间:
2015-04-18 14:40:39
阅读次数:
115
今天公司突然要把所有测试环境ROOT密码收回,只发放普通用户权限。因为测试环境要经常改时间来测试,Linux下普通用户无修改时间权限。原本我的思路是写一个脚本(自动sodu到ROOT用户执行修改时间在切换回普通用户)脚本如下:#!/bin/bashexp(){expect-c"spawnsu-root-c\"$2\"expe..
分类:
系统相关 时间:
2015-04-16 10:29:51
阅读次数:
162
#!/usr/bin/env python#coding=utf-8'''Created on 2013-8-22@author: *****'''import MySQLdbimport timeimport pexpectimport subprocessimport osimport sock...
分类:
编程语言 时间:
2015-04-10 19:39:07
阅读次数:
403
Is it reasonable to expect mere mortals to have mastery over every facet of the development stack? Probably not, but Facebook can ask for it. I was told at OSCON by a Facebook employee that they on...
分类:
其他好文 时间:
2015-04-08 13:21:59
阅读次数:
192
#!/usr/bin/expect-f
setdtime[lindex$argv0]
setpassword111111
settimeout3000;
spawn/usr/bin/scp/software/databk/$dtime.sqlcdczhangg@10.151.254.25:/software/mysqldata/
#spawnsshcdczhangg@10.151.254.25
expect{
"*yes/no"{send"yes\r";exp_continue}
"*password:"{s..
分类:
系统相关 时间:
2015-04-05 19:02:31
阅读次数:
204