Skip to content

Instantly share code, notes, and snippets.

@kimw
Last active August 29, 2015 14:27
Show Gist options
  • Save kimw/4a119e12191ac6582109 to your computer and use it in GitHub Desktop.
Save kimw/4a119e12191ac6582109 to your computer and use it in GitHub Desktop.
/etc/init.d/shadowsocks
#!/bin/sh
#
# shadowsocks - this script starts and stops the shadowsocks daemin
#
# Downloaded from:
# https://gist.github.com/kimw/4a119e12191ac6582109
#
### BEGIN INIT INFO
# Provides: shadowsocks
# Required-Start: $remote_fs $network $named
# Required-Stop: $remote_fs $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop shadowsocks
# Description: Start/stop shadowsocks daemon and its configured
# subprocesses.
### END INIT INFO
. /lib/lsb/init-functions
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/ssserver
DAEMON_OPTS='-c /etc/shadowsocks.json'
NAME=shadowsocks
DESC=shadowsocks
start() {
$DAEMON $DAEMON_OPTS -d start
}
stop() {
$DAEMON $DAEMON_OPTS -d stop
}
restart() {
$DAEMON $DAEMON_OPTS -d restart
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: "$0" {start|stop|restart}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment