Update shadowsocks auto start script

This commit is contained in:
Teddysun 2015-03-10 12:56:08 +08:00
parent 6e64ccc4e2
commit c67c6ce7c8

View File

@ -11,12 +11,14 @@
# Description: Start or stop the Shadowsocks server
### END INIT INFO
# Author: Teddysun <i@teddysun.com>
name=shadowsocks
BIN=/usr/bin/ssserver
conf=/etc/shadowsocks.json
#pid=/var/run/shadowsocks.pid
name='shadowsocks'
start(){
/usr/bin/ssserver -c $conf -d start
$BIN -c $conf -d start
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
echo "$name start success"
@ -26,9 +28,9 @@ start(){
}
stop(){
pid=`ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' | awk '{print $2}'`
pid=`ps -ef | grep -v grep | grep -v ps | grep -i "/usr/bin/python ${BIN}" | awk '{print $2}'`
if [ ! -z $pid ]; then
/usr/bin/ssserver -c $conf -d stop
$BIN -c $conf -d stop
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
echo "$name stop success"
@ -42,7 +44,7 @@ stop(){
}
status(){
pid=`ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' | awk '{print $2}'`
pid=`ps -ef | grep -v grep | grep -v ps | grep -i "/usr/bin/python ${BIN}" | awk '{print $2}'`
if [ -z $pid ]; then
echo "$name is not running"
RETVAL=1