Skip to content

Instantly share code, notes, and snippets.

@ergatea
Last active December 10, 2015 22:48
Show Gist options
  • Save ergatea/4504860 to your computer and use it in GitHub Desktop.
Save ergatea/4504860 to your computer and use it in GitHub Desktop.
Shadowsocks 启动脚本
Shadowsocks 启动脚本
insserv -v -d /etc/init.d/shadowsocks
#!/bin/sh
### BEGIN INIT INFO
# Provides: shadowsocks
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: starts the shadow socks service
### END INIT INFO
# 配置信息
PATH=$PATH:/usr/local/bin/
DAEMON=/usr/local/bin/shadowsocks
PIDFILE=/var/run/shadowsocks.pid
OPTS="-s 8.8.8.8 -p 8964 -l 1080 -k fuck!"
case $1 in
start)
echo "Starting Shadow Socks local"
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- $OPTS -f $PIDFILE
;;
stop)
echo "Stopping Shadow Socks local"
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
;;
restart|force-reload)
$0 stop && sleep 2 && $0 start
;;
reload)
exit 3
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|reload}"
exit 2
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment