codis启动dashboard脚本:

#!/bin/sh

pid=$(ps aux | grep codis-config | grep -v grep | awk '{print $2}')
cmd=/usr/local/codis/bin/codis-config
conf=/etc/codis/config.ini
log=/var/log/codis/dashboard.log
addr=$(ip ro li | awk '/^192/ {print $NF}')
port=18087

case "$1" in
    start)
        if [ -n "$pid" ]; then
            echo "${pid} exists, process is already running or crashed"
        else
            echo "Starting Codis Dashboard..."
            ${cmd} -c ${conf} -L ${log} dashboard --addr=${addr}:${port} --http-log=/var/log/codis/http.log &
        fi
        ;;
    stop)
        if [ -z "$pid" ];then
            echo "${pid} does not exist, process is not running"
        else
            echo "Stopping ..."
            kill ${pid}
            while :
            do
                new_status=$(ps aux | grep codis-config | grep -v grep | awk '{print $2}')
                if [ "$pid" = "${new_status}" ];then
                    echo "Waiting for codis-config to shutdown ..."
                    sleep 1
                else
                    echo "codis config closed."
                    break
                fi
            done
        fi
        ;;
    *)
        echo "Please use start or stop as first argument"
        ;;
esac

results matching ""

    No results matching ""