一个简单的shadowsocks启动脚本

#!/bin/bash
#processname: shadowsocks

#/usr/bin/nohup /usr/local/bin/ssserver -c /usr/local/shadowsocks/config.json > log &

case $1 in

    start)
        echo -n "Starting shadowsocks"
        nohup /usr/local/bin/ssserver -c /usr/local/shadowsocks/config.json > /usr/local/shadowsocks/log &
        echo " done"
    ;;

    stop)
        echo -n "Stopping shadowsocks"
        kill -9 `ps -ef|grep '/usr/bin/python /usr/local/bin/ssserver'|grep -v 'grep'|awk {'print $2'}`
        echo " done"
    ;;

    restart)
        echo -n "Restarting shadowsocks"
        $0 stop
        sleep 1
        $0 start
        echo " done"
    ;;

    *)
        echo -n "Usage: $0 {start|stop|restart}"
    ;;

esac
 

发表评论

电子邮件地址不会被公开。 必填项已用*标注