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
  • 相关阅读:
    如何通过CSS3实现背景图片色彩的梯度渐变
    提升网站页面打开速度的12个建议
    DIV+CSS高手必知的15个CSS常识
    飞机订票-1注册用户脚本
    需求不明的测试
    职业发展-外包公司考虑项
    Linux-Apache+Mysql+PHP+PHPWind(重点Apache+PHP集成环境)
    LR11-更改licence
    Linux-服务排查
    C语言-删除重复字符
  • 原文地址:https://www.cnblogs.com/chong-zuo3322/p/14212008.html
Copyright © 2011-2022 走看看