diff options
Diffstat (limited to 'net-proxy/trojan/files')
-rwxr-xr-x | net-proxy/trojan/files/trojan.initd | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net-proxy/trojan/files/trojan.initd b/net-proxy/trojan/files/trojan.initd new file mode 100755 index 000000000000..f525eefe74df --- /dev/null +++ b/net-proxy/trojan/files/trojan.initd @@ -0,0 +1,26 @@ +#!/sbin/openrc-run +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +TJ_CONFIG="/etc/trojan/config.json" +TJ_PIDFILE="/run/trojan.pid" +TJ_LOG="/var/log/trojan.log" + +depend() { + need net +} + +start() { + ebegin "Starting Trojan, Log File: ${TJ_LOG}" + start-stop-daemon --start -b \ + -1 "${TJ_LOG}" -2 "${TJ_LOG}" \ + -m -p "${TJ_PIDFILE}" \ + --exec /usr/bin/trojan -- "${TJ_CONFIG}" + eend $? +} + +stop() { + ebegin "Stopping Trojan" + start-stop-daemon --stop -p "${TJ_PIDFILE}" + eend $? +} |