#!/bin/sh

# PROVIDE: ssserver_rust
# REQUIRE: NETWORKING SERVERS
#
# Add the following lines to /etc/rc.conf to run ssserver:
# ssserver_rust_enable (bool):	Set it to "YES" to enable ssserver.
#				Default is "NO".
# ssserver_rust_args (string):	Set it to the desired arguments to run ssserver.
#				Default is "-c /usr/local/etc/shadowsocks-rust/config.json".
#

. /etc/rc.subr

name="ssserver_rust"
rcvar=ssserver_rust_enable

pidfile="/var/run/${name}.pid"
logfile="/var/log/${name}.log"

: ${ssserver_rust_enable="NO"}
: ${ssserver_rust_args="-c /usr/local/etc/shadowsocks-rust/config.json"}

procname=/usr/local/bin/ssserver
command="/usr/sbin/daemon"
command_args="-f -S \
	-p ${pidfile} \
	-o ${logfile} \
	-t ${name}_ssserver \
	/usr/local/bin/ssserver $ssserver_rust_args"

load_rc_config $name
run_rc_command "$1"
