#!/sbin/openrc-run # Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 SS_CONFIG="${SS_CONFIG:-/etc/shadowsocks-rust/local.json}" SS_LOGDIR="${SS_LOGDIR:-/var/log/shadowsocks-rust}" extra_started_commands="reload" description="A lightweight local socks5 proxy" output_log="${output_log:-/dev/null}" error_log="${error_log:-${SS_LOGDIR}/local-error.log}" command="/usr/bin/sslocal" command_args="-c ${SS_CONFIG} ${SS_OPTS}" command_user="${command_user:-shadowsocks-rust:shadowsocks-rust}" command_background=yes pidfile="/run/${RC_SVCNAME}.pid" required_files="${SS_CONFIG}" start_stop_daemon_args="${SSD_OPTS} -1 ${output_log} -2 ${error_log}" depend() { need net } start_pre() { checkpath -d -m 0750 -o "${command_user}" "${SS_LOGDIR}" } reload() { ebegin "Refreshing ${RC_SVCNAME} configuration" start-stop-daemon --signal HUP --pidfile "${pidfile}" eend $? "Failed to reload ${RC_SVCNAME}" }