shell脚本自动化收集
来源:互联网 发布:百度新闻的评论 知乎 编辑:程序博客网 时间:2024/06/05 23:55
将某文件远程拷贝到指定ip机器上的指定目录下:
./scp_file.sh /tmp/xx.sh /tmp/test/
echo "将文件 $1 拷贝到 $2 目录下!"for ip in 192.168.60.243 192.168.60.244 192.168.60.245 192.168.60.246 192.168.60.248do scp -r $1 root@$ip:$2 echo "scp $1 to $ip is : $? "doneecho "$? 分发完毕!!"
远程执行指定ip机器上的指定shell文件命令(需要ssh支持)(可带参数):
./execute.sh /tmp/xx.sh xx
for ip in 192.168.60.243 192.168.60.244 192.168.60.245 192.168.60.246 192.168.60.248do ssh root@$ip $1 $2 echo "execute $1 $2 at $ip is : $? "doneecho "$? $1执行完毕!"
copy-hosts.sh
#!/bin/bashcp /opt/tmp/hosts.txt /opt/tmp/hosts.txt.bakecho "$? copy finish!"exit 0
append-ssh.sh
#!/bin/bashcat /opt/tmp/ssh.txt >> /root/.ssh/authorized_keysecho "$? append ssh finish!"exit 0
rmtest.sh
#!/bin/bashrm -rf $1echo "$? rm finish!"exit 0
install-hadoop-hbase.sh
#!/bin/bashcp /opt/tmp/hadoop-2.5.1.tar.gz /opt/hadoop-2.5.1.tar.gzcp /opt/tmp/hbase-0.98.7-hadoop2-bin.tar.gz /opt/hbase-0.98.7-hadoop2-bin.tar.gzecho "$? copy finish!"cd /opt/tar xvf hbase-0.98.7-hadoop2-bin.tar.gzecho "$? install hbase finish!"tar xvf hadoop-2.5.1.tar.gzecho "$? install hadoop finish!"exit 0
install-jdk.sh
#!/bin/bashmkdir -p /usr/java/cp /opt/tmp/jdk-6u45-linux-x64.bin /usr/java/jdk-6u45-linux-x64.binecho "$? copy finish!"cd /usr/java/sh /usr/java/jdk-6u45-linux-x64.binecho "$? install jdk finish!"exit 0
set-keygen.sh
#!/bin/bashssh-keygen -t dsa -P '' -f ~/.ssh/id_dsaecho "$? set ssh keygen finish!"exit 0
阅读全文
0 0
- shell脚本自动化收集
- shell 脚本自动化
- Shell自动化脚本整理
- shell脚本收集
- Shell脚本实现自动化安装
- 自动化脚本之Shell、awk
- Hadoop自动化安装shell脚本
- Shell脚本-自动化部署WEB
- Ambari自动化卸载shell脚本
- iOS自动化打包脚本(shell)
- 自动化编译shell脚本_jenkins
- 自动化部署的shell脚本
- shell编写自动化发布脚本
- 收集mysql负载shell脚本
- Android自动化测试shell脚本(飞车Asphalt5)
- shell脚本自动化采集性能sql
- 使用shell脚本实现android自动化测试
- Ubuntu pptpd 搭建自动化shell脚本
- hadoop MapReduce初试遇到的问题
- HBase日常维护
- activemq启动异常
- C++改变集合元素的值
- HBase 常用Shell命令
- shell脚本自动化收集
- HBase操作注意事项
- 分布式服务框架 Zookeeper -- 管理分布式环境中的数据
- 知识链-消息中间件
- 知识链-分布式协调服务zookeeper
- 知识链-办公
- request.getScheme()的使用方法
- Django-ORM进阶操作02
- css中HSLA