bigdata_批量机器执行通用脚本
2024-10-19 15:48:25
经常有这样的场景,需要批量验证一些配置或者机器,执行一些命令。例如 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
最新文章
- [LeetCode] Count Primes 质数的个数
- C# WebService输出JSON 实现二
- 腾讯云环境配置之PHP5.6.3 + redis扩展 稳定版
- Netty5 + HTTPS 练习
- 读书笔记——OpenGL超级宝典
- android stack error message is Fail to start the plugin
- careercup-C和C++ 13.7
- Volley报错!!!No address associated with hostname
- illegal to have multiple occurrences of contentType with different values (old: text/html; charset=UTF-8, new: text/html; charset=utf-8)
- CSS3重点总结
- Android API在不同版本系统上的兼容性
- Android 程序申请权限小知识点
- sql with as 用法(转载)
- Springboot+resteasy定时任务
- 数列分块总结——题目总版(hzwer分块九题及其他题目)(分块)
- 用python写一个北京市的个税计算器
- Nginx缓存
- WPF 矩形框8个控制点伸缩及拖拽
- Golang 入门~~基础知识
- everything 提供http和ftp的功能