Skip to content

Instantly share code, notes, and snippets.

@LvWind
Created December 8, 2017 09:21
Show Gist options
  • Save LvWind/132465efc09ea5e4ad12659caa74db50 to your computer and use it in GitHub Desktop.
Save LvWind/132465efc09ea5e4ad12659caa74db50 to your computer and use it in GitHub Desktop.
sslocal
#!/bin/bash
### BEGIN INIT INFO
# Provides: sslocal
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: start sslocal service
### END INIT INFO
DESC="start sslocal service"
NAME=ss-local
OWNER=shadowsocks
DAEMON=/usr/local/bin/$NAME
PIDFILE=/var/run/$NAME.pid
CONFIGFILE=/etc/shadowsocks-libev/config.json.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