diff options
Diffstat (limited to 'net-proxy/trojan/files')
-rw-r--r-- | net-proxy/trojan/files/trojan.initd | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net-proxy/trojan/files/trojan.initd b/net-proxy/trojan/files/trojan.initd index 2990245430db..348d307c5264 100644 --- a/net-proxy/trojan/files/trojan.initd +++ b/net-proxy/trojan/files/trojan.initd @@ -2,6 +2,9 @@ # Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +TJ_USER=nobody +TJ_GROUP=nobody + TJ_NAME=${SVCNAME##*.} if [ -n "${TJ_NAME}" -a "${SVCNAME}" != "trojan" ]; then TJ_PIDFILE="/run/trojan.${TJ_NAME}.pid" @@ -19,15 +22,19 @@ depend() { start() { ebegin "Starting Trojan, Log File: ${TJ_LOG}" - start-stop-daemon --start -b \ - -1 "${TJ_LOG}" -2 "${TJ_LOG}" \ - -m -p "${TJ_PIDFILE}" \ + checkpath -f -m 0600 -o ${TJ_USER}:${TJ_GROUP} "${TJ_LOG}" + start-stop-daemon --start --background \ + --user ${TJ_USER} --group ${TJ_GROUP} \ + --stdout "${TJ_LOG}" --stderr "${TJ_LOG}" \ + --make-pidfile --pidfile "${TJ_PIDFILE}" \ --exec /usr/bin/trojan -- "${TJ_CONFIG}" eend $? } stop() { ebegin "Stopping Trojan" - start-stop-daemon --stop -p "${TJ_PIDFILE}" + start-stop-daemon --stop \ + --user ${TJ_USER} --group ${TJ_GROUP} \ + --pidfile "${TJ_PIDFILE}" eend $? } |