ss和kcptun启动脚本编写

#!/bin/bash

if [ $# -lt 1 ];then
    echo "$0 start|stop"
    exit 0
fi

SERVER="www.meijubie.com"

start()
{
    echo "Starting..."
    /home/chin/kcptun/client_linux_amd64 -l :12948 -r ${SERVER}:19900 -key hello -mode fast2 -sndwnd 2048 -rcvwnd 2048 &
    /usr/local/bin/sslocal -s 127.0.0.1 -p 12948 -k hello -l 1080 -b 0.0.0.0 -m aes-256-cfb -d start

}
stop()
{
    echo "Stoping..."
    CLIENT_PID=`ps -ef | grep client_linux_amd64 | grep -v grep | awk '{print $2}'`
    kill -9 $CLIENT_PID
    /usr/local/bin/sslocal -s 127.0.0.1 -p 12948 -k hello -l 1080 -b 0.0.0.0 -m aes-256-cfb -d stop

}

case $1 in
    start)
        start
    ;;
    stop)
        stop
    ;;
    *)
        echo "$0 start|stop"
        exit 0
    ;;
esac

exit 0

滚动至顶部