ps -ef | grep 服务名 | grep -v grep | wc -l
返回服务的数量
es_status=`ps -ef | grep elasticsearch | grep -v grep | wc -l`
if [[ $es_status -eq 0 ]]; then
echo "elasticsearch 已停止,启动中。。。"
service elasticsearch start
fi
kylo_num=`kylo-service status | grep "Running" | wc -l`
if [[ $kylo_num -eq 0 ]]; then
echo "kylo-service 已停止,启动中。。。"
kylo-service start
fi
网友评论