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