Skip to content

Commit

Permalink
判断是否已经添加自启动 && 增加自定义端口,默认端口改为1024
Browse files Browse the repository at this point in the history
  • Loading branch information
flyzy2005 committed Jan 31, 2018
1 parent 89940c5 commit 27719f1
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions ss-fly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@ wrong_para_prompt() {
}

install() {
if [[ "$#" -ne 1 ]]; then
wrong_para_prompt "请输入密码"
return 1
if [[ "$#" -lt 1 ]]
then
wrong_para_prompt "请输入至少一个参数作为密码"
return 1
fi
port="1024"
if [[ "$#" -ge 2 ]]
then
port=$2
fi
if [[ $port -le 0 || $port -gt 65535 ]]
then
wrong_para_prompt "端口号输入格式错误,请输入1到65535"
exit 1
fi
echo "{
\"server\":\"0.0.0.0\",
\"server_port\":8388,
\"server_port\":$port,
\"local_address\": \"127.0.0.1\",
\"local_port\":1080,
\"password\":\"$1\",
Expand All @@ -32,7 +43,11 @@ install() {
chmod 755 /etc/shadowsocks.json
apt-get install python-m2crypto
ssserver -c /etc/shadowsocks.json -d start
sed -i '$i\ssserver -c /etc/shadowsocks.json -d start' /etc/rc.local
rclocal=`cat /etc/rc.local`
if [[ $rclocal != *'ssserver -c /etc/shadowsocks.json -d start'* ]]
then
sed -i '$i\ssserver -c /etc/shadowsocks.json -d start' /etc/rc.local
fi
echo '安装成功~尽情冲浪吧'
}

Expand Down Expand Up @@ -92,7 +107,7 @@ fi

case $1 in
-i|i|install )
install $2
install $2 $3
;;
-bbr )
install_bbr
Expand Down

0 comments on commit 27719f1

Please sign in to comment.