linux集群整体操作脚本
程序员文章站
2024-02-25 16:57:09
...
1.在/root/bin目录下创建脚本xcall.sh
[[email protected] bin]$ vim xcall.sh
2.在脚本中编写如下内容
#! /bin/bash
for i in hadoop100 hadoop101 hadoop102
do
echo --------- $i ----------
ssh $i "$*"
done
3.修改脚本执行权限
[[email protected] bin]$ chmod +x xcall.sh
4.将/etc/profile文件追加到~/.bashrc后面
[[email protected] module]# echo 'source /etc/profile' >> ~/.bashrc
[[email protected] module]# echo 'source /etc/profile' >> ~/.bashrc
[[email protected] module]# echo 'source /etc/profile' >> ~/.bashrc