zoukankan      html  css  js  c++  java
  • 4g项目shell脚本

    Ambari开机自启脚本startHDP:

    #!/bin/bash
    # Name: 
    # DESC: start HDP instance
    # Path: 
    # chkconfig: 2345 55 25
    
    
    host=$(hostname)
    
    _STARTHDP(){
            curl -s -i -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Start all
     services","operation_level":{"level":"CLUSTER","cluster_name":"ULTIWILL_HDP"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://hdp05.ultiwill.com:8080/api/v1/clusters/ULTIWILL_HDP/services}
    
    AMBARI_RUNNING=`jps|grep AmbariServer`
    if [ -n "${AMBARI_RUNNING}" ];then
           time=$( date '+%Y-%m-%d %H:%M:%S')
           echo  "$@ $host $time HDP " >> /root/powerOn.log
            _STARTHDP  >> /root/powerOn.log
    else
            sleep 60
            time=$( date '+%Y-%m-%d %H:%M:%S')
            echo  "$@  sleep $host $time HDP " >> /root/powerOn.log
            _STARTHDP  >> /root/powerOn.log
    fi

    Elasticsearch开机自启脚本startES:

    #!/bin/bash
    #
    # chkconfig: 2345 55 25
    # description:start ES instance
    
    
    host=$(hostname)
    
    time=$( date '+%Y-%m-%d %H:%M:%S')
    echo  "$@ $host $time elasticsearch-6.1.0" >> /root/powerOn.log
    su - elastic -c '/usr/local/elasticsearch-6.1.0/bin/elasticsearch -d'
    
    time=$( date '+%Y-%m-%d %H:%M:%S')
    echo  "$@ $host $time cerebro " >> /root/powerOn.log
    su - elastic -c "nohup /usr/local/cerebro-0.7.2/bin/cerebro >/dev/null &"
    
    
    time=$( date '+%Y-%m-%d %H:%M:%S')
    echo  "$@ $host $time kibana" >> /root/powerOn.log
    su - elastic -c "nohup /usr/local/kibana-6.1.0-linux-x86_64/bin/kibana >/dev/null &"
    
    
    time=$( date '+%Y-%m-%d %H:%M:%S')
    echo  "$@ $host $time kafka-manager" >> /root/powerOn.log
    num=$(netstat -ntlp |grep 9997 |wc -l)
    RUNNING_FILE=/usr/local/kafka-manager-1.3.3.7/RUNNING_PID
    if [[ $num -eq  0 ]];then
    
      if [ -f $RUNNING_FILE ];then
        rm $RUNNING_FILE
      fi
    
       nohup /usr/local/kafka-manager-1.3.3.7/bin/kafka-manager -Dconfig.file=/usr/local/kafka-manager-1.3.3.7/conf/application.conf -Dhttp.port=9997 > /dev/null 2>&1 &
    fi

    springboot项目定时任务启动:

    #*/5 * * * * root /opt/workspace/libra-service-1.1.0/sbin/startLibra.sh
    #!/bin/bash
    
    export PROJECT_HOME=$(dirname "$(cd "$(dirname "$0")"; pwd -P)")
    
    ps=$(jps | grep 'libra-service')
    
    
    if [ -z "${ps}" ];then
      su - ultiwill -c "sh ${PROJECT_HOME}/sbin/stop.sh "
      su - ultiwill -c "sh ${PROJECT_HOME}/sbin/start.sh "
    fi
    
    
    exit 0
  • 相关阅读:
    整理了8个Python中既冷门又实用的技巧
    python中68个内置函数的总结
    Python中常见的8种数据结构的实现方法(建议收藏)
    python基础教程:dir()和__dict__属性的区别
    Python 优雅获取本机 IP 方法
    Python类中的self到底是干啥的
    python中反转列表的三种方式
    Flask学习笔记(2)-login_page
    利用Flask + python3.6+MYSQL编写一个简单的评论模块。
    最近写了个自动填写调查的问卷的简单爬虫
  • 原文地址:https://www.cnblogs.com/chong-zuo3322/p/14212008.html
Copyright © 2011-2022 走看看