Skip to content

Instantly share code, notes, and snippets.

@perqin
Last active August 6, 2016 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save perqin/2867f8fac6dbbf2514b7471095233668 to your computer and use it in GitHub Desktop.
Save perqin/2867f8fac6dbbf2514b7471095233668 to your computer and use it in GitHub Desktop.
sslocal init.d script
#! /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