ss-libev控制脚本

适用于:*-libev-3.0.3

操作系统:CentOS6.8

#!/bin/sh

*_SERVER="/usr/local/*-libev/bin/ss-server"
SERVER_CONF="/etc/*-libev/config.json"
RET_VAL=

check_running()
{
    ps -ef | grep ss-server | grep -v grep
     ]; then
        return
    else
        return
    fi
}

ss_start()
{
    if check_running; then #shell if判断 返回0 为真
        statusid=`ps -ef | grep ss-server | grep -v grep | awk '{print $2}'`
        echo ${statusid}" is already running..."
        return
    fi
    nohup $*_SERVER -u -c $SERVER_CONF & #至于为什么要加-u参数,是因为要开启udp协议的支持,否则会报 unable to resolve 无法进行DNS查询
    if check_running; then
        echo "Starting * success"
    else
        "Starting * failed"
        RET_VAL=
    fi
}

ss_stop()
{
    if check_running; then
        ps -ef | grep ss-server | grep -v grep | awk '{print "kill -9 "$2}' | sh
        echo "Stopping * success"
    else
        echo "* is stopped"
        RET_VAL=
    fi
}

ss_restart()
{
    ss_stop
    ss_start
}

 in
    'start'|'stop'|'restart')
        ss_$
        ;;
    *)
        "Usage: $0 { start | stop | restart }"
        RET_VAL=
        ;;
esac

exit $RET_VAL
上一篇:云计算之阿里仓库停止openstack mitaka源报错“No package centos-release-openstack-mitaka available.”


下一篇:C# Oracle批量插入数据进度条制作