shell编程【分发系统】
来源:互联网 发布:网络安全保密基础知识 编辑:程序博客网 时间:2024/05/16 01:50
1
2
3
4
5
6
7
8
9
#! /usr/bin/expect
set
host
"192.168.101.108"
set
passwd
"daixuan"
spawn
ssh
root@$host
expect {
"yes/no"
{ send
"yes\r"
; exp_continue}
"assword:"
{ send
"$passwd\r"
}
}
interact
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/expect
set
user
"root"
set
passwd
"daixuan"
spawn
ssh
$user@192.168.11.108
expect {
"yes/no"
{ send
"yes\r"
; exp_continue}
"password:"
{ send
"$passwd\r"
}
}
expect
"]*"
send
"touch /tmp/12.txt\r"
expect
"]*"
send
"echo 1212 > /tmp/12.txt\r"
expect
"]*"
send
"exit\r"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/expect
set
user [lindex $argv 0]
set
host [lindex $argv 1]
set
passwd
"daixuan"
set
cm [lindex $argv 2]
spawn
ssh
$user@$host
expect {
"yes/no"
{ send
"yes\r"
}
"password:"
{ send
"$passwd\r"
}
}
expect
"]*"
send
"$cm\r"
expect
"]*"
send
"exit\r"
1
2
3
4
5
6
7
8
#!/usr/bin/expect
set
passwd
"daixuan"
spawn
rsync
-av root@192.168.101.108:
/tmp/12
.txt
/tmp/
expect {
"yes/no"
{ send
"yes\r"
}
"password:"
{ send
"$passwd\r"
}
}
expect eof
#这里必须有expect eof,否则只是登陆但不同步数据
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/expect
set
passwd
"daixuan"
set
host [lindex $argv 0]
set
file
[lindex $argv 1]
spawn
rsync
-av $
file
root@$host:$
file
expect {
"yes/no"
{ send
"yes\r"
}
"password:"
{ send
"$passwd\r"
}
}
expect eof
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/expect
set
passwd
"daixuan"
set
host [lindex $argv 0]
set
file
[lindex $argv 1]
spawn
rsync
-av --files-from=$
file
/ root@$host:/
expect {
"yes/no"
{ send
"yes\r"
}
"password:"
{ send
"$passwd\r"
}
}
expect eof
1
2
3
4
5
6
#!/bin/bash
for
ip
in
`
cat
ip.list`
do
echo
$ip
.
/rsync
.expect $ip list.txt
done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/expect
set
host [lindex $argv 0]
set
passwd
"daixuan"
set
cm [lindex $argv 1]
spawn
ssh
root@$host
expect {
"yes/no"
{ send
"yes\r"
}
"password:"
{ send
"$passwd\r"
}
}
expect
"]*"
send
"$cm\r"
expect
"]*"
send
"exit\r"
1
2
3
4
5
6
#!/bin/bash
for
ip
in
`
cat
ip.list`
do
echo
$ip
.
/exe
.expect $ip
"w;free -m;ls /tmp"
done
0 0
- shell编程【分发系统】
- shell脚本_【分发系统】
- Shell分布式系统分发文件脚本
- linux系统-shell编程-几个shell脚本
- Linux系统--SHELL编程小记
- linux系统-shell编程-变量
- linux 分发让shell
- linux系统作业——shell编程
- linux系统之shell编程-正则表达式
- linux系统-shell编程-基本调试执行
- Linux系统Shell编程基础知识储备
- shell编程常见的系统变量解析
- shell编程3_警系统
- Linux系统shell脚本编程(四)
- linux系统-shell编程-一个简单的shell程序
- linux系统-shell编程-shell命令与语句
- awk写shell分发脚本
- BREW分发系统综述
- XML学习(一)-四种XML文件读取方式
- Spring使用CFX发布Webservice
- Linux命令的返回值
- mtk如何在源码中删除系统自带apk
- mvp模式下实现登录小dem
- shell编程【分发系统】
- android6.0创建新的文件夹
- Lambda表达式详解(原文:张龙豪 http://www.cnblogs.com/knowledgesea/p/3163725.html)
- Hadoop Sequence File 文件的读取和写入
- [CDN] 使用Python 进行批量指定节点进行URL测试
- UnityColor Space的设置,Gamma还是Linear
- 数组排序之compare使用
- 20170509
- java 集合-概述