#!/bin/sh /etc/rc.common

START=95

SERVICE_USE_PID=1
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1

CONFIG=/etc/shadowsocksr.json
if [ ! -f $CONFIG ]; then
  ln -sf /etc/shadowsocksr.json.main $CONFIG
fi

start() {
	service_start /usr/bin/ssr-redir -c $CONFIG -b 0.0.0.0 -l 8989
	sleep 1
	service_start /usr/bin/ssr-tunnel -c $CONFIG -b 0.0.0.0 -l 5353 -L 8.8.8.8:53 -U
	sleep 1
}

stop() {
	service_stop /usr/bin/ssr-redir
	sleep 1
	service_stop /usr/bin/ssr-tunnel
	sleep 1
}
