• 设备
    • 今日
    • 1

    配置sh文件到chkconfg

    vi /etc/rc.d/init.d/zookeeper

    #!/bin/bash
    #chkconfig:2345 20 90
    #description:zookeeper
    #processname:zookeeper
    case $1 in
              start) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh start;;
              stop) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh stop;;
              status) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh status;;
              restart) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh restart;;
              *)  echo "require start|stop|status|restart"  ;;

    esac   


    chmod a+x /etc/rc.d/init.d/zookeeper
    chkconfig --add zookeeper

    chkconfig zookeeper on

    --------------------------------------

    vi /etc/init.d/redsentinel

    #!/bin/bash
    #chkconfig:2345 95 70   
    # redis-sentinel /etc/redis/sentinel.conf --sentinel &>/var/log/redis_28379_sentinal.log &
    # Starts redis sentinel using start-stop-daemon
    # Jimmy,http://www.jimmy2k.top/
    # 2016-02-17


    NAME=redis-sentinel
    #BIN=/usr/local/bin/redis-server # --1--
    BIN=/usr/local/bin/redis-sentinel
    CONF=/etc/redis/sentinel.conf
    SENTINEL_PID=/tmp/redis-sentinel.pid
    CMD=$1
    start() {
       echo "Starting $NAME ..."
       # exec 2>&1 $BIN $CONF --sentinel | logger -t sentinel & # --2--
       #exec 2>&1 $BIN $CONF --sentinel &>/dev/null &
       exec 2>&1 $BIN $CONF --sentinel &>/var/log/redis_28379_sentinal.log &
       echo $! > "${SENTINEL_PID}";
    }

    stop() {
       PID=`cat $SENTINEL_PID`
       echo "Stopping $NAME ($PID) ..."
       kill $PID
    }

    restart() {
       echo "Restarting $NAME ..."
       stop
       start
    }

    status() {
       echo "Usage $0 {start|stop|restart}"
    }

    case "$CMD" in
       start)
         start
         ;;
       stop)
         stop
         ;;
       restart)
         restart
         ;;
       status) 
         status 
         ;; 
       *)
         echo "Usage $0 {start|stop|restart}"
    esac

    来自:PC 广东省
    上一篇: 利用Keepalived+mysql构建高可用MySQL双主自动切转
    您可能还喜欢这些:

    亲,沙发正空着,还不快来抢?

    评论审核已开启 记住我的个人信息 回复后邮件通知我