经常有这样的场景,需要批量验证一些配置或者机器,执行一些命令。例如  echo $PATH  等等

这里分享一个批量执行脚本

脚本名称 deployCommnd.sh

运行demo : sh deployCommnd.sh 'ps aux|grep hiveserver2 |grep -v "grep"'

host目录:可以自行修改添加 集群ip。  【前置条件】机器之间无秘登录

脚本如下

#!/bin/sh
hosts=(192.168.7.126 192.168.7.127 192.168.7.128 192.168.7.129 192.168.7.130)
commd=$
for host in ${hosts[@]}
do
echo $host
echo 'will exctue '$commd
ssh root@$host $commd
echo $?
done

最新文章

  1. [LeetCode] Count Primes 质数的个数
  2. C# WebService输出JSON 实现二
  3. 腾讯云环境配置之PHP5.6.3 + redis扩展 稳定版
  4. Netty5 + HTTPS 练习
  5. 读书笔记——OpenGL超级宝典
  6. android stack error message is Fail to start the plugin
  7. careercup-C和C++ 13.7
  8. Volley报错!!!No address associated with hostname
  9. illegal to have multiple occurrences of contentType with different values (old: text/html; charset=UTF-8, new: text/html; charset=utf-8)
  10. CSS3重点总结
  11. Android API在不同版本系统上的兼容性
  12. Android 程序申请权限小知识点
  13. sql with as 用法(转载)
  14. Springboot+resteasy定时任务
  15. 数列分块总结——题目总版(hzwer分块九题及其他题目)(分块)
  16. 用python写一个北京市的个税计算器
  17. Nginx缓存
  18. WPF 矩形框8个控制点伸缩及拖拽
  19. Golang 入门~~基础知识
  20. everything 提供http和ftp的功能

热门文章

  1. Android应用性能測试
  2. C# WinForm多线程(一)Thread类库
  3. Java NIO 系列教程(转)
  4. nuget 命令详解
  5. CocoStudio学习资源
  6. 怎样用C#代码管理SharePoint解决方式
  7. AutoMapper在ABP框架
  8. 阿里2015在线研发project师笔试题(部分)
  9. mysql常见操作汇总
  10. 深入了解C++中间mutablekeyword