Update latest config file's fields

This commit is contained in:
Teddysun 2014-05-29 11:24:11 +08:00
parent 8ab25aa749
commit 438f1d7735

View File

@ -93,8 +93,8 @@ function download_files(){
# Config shadowsocks # Config shadowsocks
function config_shadowsocks(){ function config_shadowsocks(){
touch /etc/config.json touch /etc/shadowsocks.json
cat >>/etc/config.json<<-EOF cat >>/etc/shadowsocks.json<<-EOF
{ {
"server":"${IP}", "server":"${IP}",
"server_port":8989, "server_port":8989,
@ -103,7 +103,8 @@ function config_shadowsocks(){
"password":"${shadowsockspwd}", "password":"${shadowsockspwd}",
"timeout":600, "timeout":600,
"method":"aes-256-cfb", "method":"aes-256-cfb",
"fast_open":false "fast_open":false,
"workers":1
} }
EOF EOF
} }
@ -136,7 +137,7 @@ function install(){
pip install shadowsocks pip install shadowsocks
if [ -f /usr/bin/ssserver ]; then if [ -f /usr/bin/ssserver ]; then
# Run shadowsocks in the background # Run shadowsocks in the background
nohup ssserver -c /etc/config.json > /dev/null 2>&1 & nohup ssserver -c /etc/shadowsocks.json > /dev/null 2>&1 &
sleep 1 sleep 1
# Run success or not # Run success or not
ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' > /dev/null 2>&1 ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' > /dev/null 2>&1
@ -149,7 +150,7 @@ function install(){
cat /etc/rc.d/rc.local | grep 'ssserver' > /dev/null 2>&1 cat /etc/rc.d/rc.local | grep 'ssserver' > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak
echo "nohup /usr/bin/python /usr/bin/ssserver -c /etc/config.json > /dev/null 2>&1 &" >> /etc/rc.d/rc.local echo "nohup /usr/bin/python /usr/bin/ssserver -c /etc/shadowsocks.json > /dev/null 2>&1 &" >> /etc/rc.d/rc.local
fi fi
else else
echo "" echo ""
@ -189,7 +190,7 @@ function uninstall_shadowsocks(){
done done
fi fi
# delete config file # delete config file
rm -f /etc/config.json rm -f /etc/shadowsocks.json
if [ -f /etc/rc.d/rc.local.bak ];then if [ -f /etc/rc.d/rc.local.bak ];then
rm -f /etc/rc.d/rc.local rm -f /etc/rc.d/rc.local
mv /etc/rc.d/rc.local.bak /etc/rc.d/rc.local mv /etc/rc.d/rc.local.bak /etc/rc.d/rc.local