美文网首页
监控服务,停止后自动重启

监控服务,停止后自动重启

作者: 夜空最亮的9星 | 来源:发表于2019-04-22 12:31 被阅读0次

    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
    

    相关文章

      网友评论

          本文标题:监控服务,停止后自动重启

          本文链接:https://www.haomeiwen.com/subject/fwlygqtx.html