1 #!/bin/bash 2 function hiveserver2_stop(){ 3 pid=$(ps ax | grep "hiveserver2") 4 kill $pid || echo "hiveserver2服务已关闭" 5 } 6 case $1 in 7 "start"){ 8 echo "________________hiveServer2 服务 开启_______________________" 9 /opt/module/hive/bin/hiveserver2 10 };; 11 "stop"){ 12 hiveserver2_stop 13 };; 14 esac 15 16 [root@hadoop106 shells]# cat spark.sh 17 #!/bin/bash 18 function spark_stop(){ 19 pid=$(ps ax | grep "spark") 20 kill $pid || echo "spark服务已关闭" 21 } 22 case $1 in 23 "start"){ 24 echo "________________spark 服务 开启_______________________" 25 /opt/module/spark/sbin/start-all.sh 26 };; 27 "stop"){ 28 spark_stop 29 };; 30 esac
#!/bin/bash function hiveserver2_stop(){ pid=$(ps ax | grep "hiveserver2") kill $pid || echo "hiveserver2服务已关闭" } case $1 in "start"){ echo "________________hiveServer2 服务 开启_______________________" /opt/module/hive/bin/hiveserver2 };; "stop"){ hiveserver2_stop };; esac [root@hadoop106 shells]# cat spark.sh #!/bin/bash function spark_stop(){ pid=$(ps ax | grep "spark") kill $pid || echo "spark服务已关闭" } case $1 in "start"){ echo "________________spark 服务 开启_______________________" /opt/module/spark/sbin/start-all.sh };; "stop"){ spark_stop };; esac