/usr/bin/expect<<EOF
settimeout50
spawn$SCP_LOG_TO_GATHER_SERVER
expect{
"*yes/no)?"
{
send"yes\n"
"*password:*"{send"GatherServerPassword\n"}
}
"*password:"
{
send"$GatherServerPassword\n"
}
}
expect"*password:"{send"$GatherServerPassword\n"}
expect"..
分类:
其他好文 时间:
2016-05-26 06:26:04
阅读次数:
170
想写自动化脚本的时候,遇到需要交互的,如ssh,scp,就束手无策,直到我知道了expect。 expect 有一系列expect-send对组成,就像聊天一样。 expect A send B expect C send D 先来个例子 #!/usr/bin/expect set timeout ...
分类:
其他好文 时间:
2016-05-13 23:15:18
阅读次数:
204
下面是配置文件,配置了spring的扫描路径,不配置这个注解不起作用。Java代码packagecom.expect.oa.config;importorg.springframework.context.annotation.ComponentScan;importorg.springframework.context.annotation.Configuration;@Configuration@ComponentScan("com.expec..
分类:
编程语言 时间:
2016-05-13 05:18:05
阅读次数:
182
1.expect实现参数传递1.1实现$argv参数数组expect脚本可以接受从bash传递过来的参数。可以使用[lindex$argvn]获得,n从0开始,分别表示第一个,第二个,第三个....参数1.2样例cattelnet.exp#!/usr/bin/expectsethost[lindex$argv0]setpasswd[lindex$argv1]setpasswden[lindex$arg..
分类:
其他好文 时间:
2016-05-10 23:57:21
阅读次数:
678
第一题ssh客户端
[lsc888@m01~]$ssh-keygen-tdsa-P‘‘-f~/.ssh/id_dsa
Generatingpublic/privatedsakeypair.
eateddirectory‘/home/lsc888/.ssh‘.
Youridentificationhasbeensavedin/home/lsc888/.ssh/id_dsa.
Yourpublickeyhasbeensavedin/home/lsc888/.ssh/id_dsa.pub.
Thekey..
分类:
系统相关 时间:
2016-05-10 23:46:12
阅读次数:
403
zebra@zebra-PC /cygdrive/c/tool/mirantis/vbox-scripts-7.0/virtualbox
$ sh launch.sh
Checking for 'free'... OK
Checking for 'expect'... OK
If you run this script under Cygwin, you may have to add p...
分类:
其他好文 时间:
2016-05-07 11:04:31
阅读次数:
329
if [ ! $# -eq 2 ] ;then
echo "请输入用户密码以空格分开"
exit
else
ssh-keygen -t rsa
#用户名
uname="$1"
#密码
passwd="$2"
fi
#执行检测并安装expect模块
ep=`rpm -qa | grep expect`
if [ -z $ep ] ; then
echo "检测到你的系统,没有安装e...
分类:
其他好文 时间:
2016-05-07 07:59:53
阅读次数:
139
dr-mysql01:/root# cat a1.sh
#用户名
uname="$1"
#密码
passwd="$2"
#执行检测并安装expect模块
ep=`rpm -qa | grep expect`
if [ -z $ep ] ; then
echo "检测到你的系统,没有安装expect模块,准备执行安装"
sleep 2
yum install -y expect
...
分类:
其他好文 时间:
2016-05-07 07:59:36
阅读次数:
138
##/bin/bashpassword=‘Aa123456‘foruserin$(cat./user_id)do/usr/bin/expect<<Eofsettimeout10expect"*#"spawn/usr/sbin/useradd${user}expect"*#"spawn/usr/bin/passwd${user}expect{"*password:"{send"$password\r";exp_continue}"*password:"{send"$password\r"}}Eofdone
分类:
其他好文 时间:
2016-05-07 01:17:42
阅读次数:
178