From 63f445f07d50989a4c0e5125164a7873d29b7dd6 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Sat, 14 Mar 2015 18:08:06 +0800 Subject: [PATCH] Update shadowsocks-go-debian --- shadowsocks-go-debian | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/shadowsocks-go-debian b/shadowsocks-go-debian index 65b6e08..2fbaf9f 100644 --- a/shadowsocks-go-debian +++ b/shadowsocks-go-debian @@ -12,9 +12,10 @@ # Short-Description: shadowsocks is a lightweight tunneling proxy ### END INIT INFO -# Note: this script requires sudo in order to run shadowsocks as the specified -# user. +# Author: Teddysun +# Daemon +NAME=shadowsocks-go BIN=/usr/bin/shadowsocks-server CONFIG_FILE=/etc/shadowsocks/config.json PID_DIR=/var/run @@ -41,13 +42,13 @@ do_status() { check_running case $? in 0) - echo "shadowsocks-go running with PID $PID" + echo "$NAME running with PID $PID" ;; 1) - echo "shadowsocks-go not running, remove PID file $PID_FILE" + echo "$NAME not running, remove PID file $PID_FILE" ;; 2) - echo "Could not find PID file $PID_FILE, shadowsocks-go does not appear to be running" + echo "Could not find PID file $PID_FILE, $NAME does not appear to be running" ;; esac return 0 @@ -58,14 +59,14 @@ do_start() { mkdir $PID_DIR || echo "failed creating PID directory $PID_DIR"; exit 1 fi if check_running; then - echo "shadowsocks-go already running with PID $PID" + echo "$NAME already running with PID $PID" return 0 fi if [[ ! -r $CONFIG_FILE ]]; then echo "config file $CONFIG_FILE not found" return 1 fi - echo "starting shadowsocks-go" + echo "starting $NAME" # sudo will set the group to the primary group of $USER $BIN -c $CONFIG_FILE > /dev/null 2>&1 & PID=$! @@ -75,13 +76,13 @@ do_start() { echo "start failed" return 1 fi - echo "shadowsocks-go running with PID $PID" + echo "$NAME running with PID $PID" return 0 } do_stop() { if check_running; then - echo "stopping shadowsocks-go with PID $PID" + echo "stopping $NAME with PID $PID" kill $PID rm -f $PID_FILE else