注意代码缩进
添加执行权限
chmod +x kf.sh
1 #! /bin/bash
2 case $1 in
3 "start"){
4 for i in hadoop102 hadoop103 hadoop104
5 do
6 echo " --------启动 $i Kafka-------"
7 ssh $i "/opt/module/kafka/bin/kafka-server-start.sh -daemon /opt/module/kafka/config/server.properties"
8 done
9 };;
10 "stop"){
11 for i in hadoop102 hadoop103 hadoop104
12 do
13 echo " --------停止 $i Kafka-------"
14 ssh $i "/opt/module/kafka/bin/kafka-server-stop.sh "
15 done
16 };;
17 esac