Skip to content

Instantly share code, notes, and snippets.

@kokororin
Created August 16, 2017 03:21
Show Gist options
  • Save kokororin/f89acdb55a623963ba53ff1f9eb300a4 to your computer and use it in GitHub Desktop.
Save kokororin/f89acdb55a623963ba53ff1f9eb300a4 to your computer and use it in GitHub Desktop.
SSR init.d script
#! /bin/sh
# Works on Ubuntu 16.04.1 LTS
DESC="start sslocal service"
NAME=sslocal
OWNER=shadowsocks
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
CONFIGFILE=/etc/shadowsocks.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