在/root
目录下创建bin文件夹再创建你的文件
文件里面写如下命令
#!/bin/bash
 if [ $# -lt 1 ]
 then
     echo "No Args Input..."
     exit ;
 fi
 case $1 in
 "start")
         echo " =================== 启动集群 ==================="
        echo " --------------- 启动 ---------------"
         ssh linux01 "source /etc/profile; 目录/命令 --daemon"
         ssh linux02 "source /etc/profile; 目录/命令 --daemon"
         ssh linux03 "source /etc/profile; 目录/命令 --daemon"
      
 ;;
 "stop")
         echo " =================== 关闭 fe ==================="
         ssh linux01 "/source /etc/profile; 目录/命令"
         ssh linux02 "/source /etc/profile; 目录/命令"
         ssh linux03 "/source /etc/profile; 目录/命令"
        
 ;;
 *)
     echo "Input Args Error..."
 ;;
 esac
给你自己的文件添加环境变量
然后运行
命令 加参数
start 或者 stop










