Last active
August 6, 2016 14:46
-
-
Save perqin/2867f8fac6dbbf2514b7471095233668 to your computer and use it in GitHub Desktop.
sslocal init.d script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Works on Ubuntu 16.04.1 LTS | |
DESC="start sslocal service" | |
NAME=sslocal | |
OWNER=shadowsocks | |
DAEMON=/usr/local/bin/$NAME | |
PIDFILE=/var/run/$NAME.pid | |
CONFIGFILE=/etc/$OWNER/$NAME.json | |
# Exit if shadowsocks is not installed | |
[ -x "$DAEMON" ] || exit 0 | |
# Define LSB log_* functions. | |
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
$DAEMON -c $CONFIGFILE --pid-file $PIDFILE -d start | |
;; | |
stop) | |
$DAEMON -c $CONFIGFILE --pid-file $PIDFILE -d stop | |
;; | |
restart) | |
$DAEMON -c $CONFIGFILE --pid-file $PIDFILE -d restart | |
;; | |
status) | |
status_of_proc "$DAEMON" "$NAME" | |
exit $? | |
;; | |
*) | |
echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment