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
  • 相关阅读:
    MVC HtmlHelper
    Bellman-ford算法、SPFA算法求解最短路模板
    Dijkstra算法求最短路模板
    静态邻接表模板
    HDU 4511 小明系列故事——女友的考验 ( Trie图 && DP )
    HDU 4758 Walk Through Squares ( Trie图 && 状压DP && 数量限制类型 )
    HDU 3341 Lost's revenge ( Trie图 && 状压DP && 数量限制类型 )
    POJ 3691 DNA repair ( Trie图 && DP )
    POJ 2456 Aggressive cows ( 二分 && 贪心 )
    HDU 2296 Ring ( Trie图 && DP && DP状态记录)
  • 原文地址:https://www.cnblogs.com/chong-zuo3322/p/14212008.html
Copyright © 2011-2022 走看看